Skip to content


Repository files navigation


A web interface for the scoring of biomedical digital objects by user evaluation according to the FAIR data principles: Findability, Accessibility, Interoperability, and Reusability.

Available at

Code Layout

  • FAIRshake: The django project settings
  • FAIRshakeHub: The website itself, gets all of its information from FAIRshakeAPI
  • FAIRshakeAPI: The primary API facilitator, is enabled with the other API components
  • extensions: Extensions to dependent libraries



Python 3 is required to run this project.

Install all dependencies into your environment.

pip install -r requirements.txt

Note that mysqlclient is the recommended client but pymysql can be used as a fallback.

Staticfiles collection

To render the page properly in development, it's necessary to collect staticfiles so they can be hosted by django.

./ collectstatic

Environment setup

# Run in debugging mode, show errors and host staticfiles locally
export DEBUG=1

# Specify location of mysql config file for production database
export MYSQL_CONFIG=$(pwd)/config/my.cnf

Django Shell

ipython is recommended: pip install ipython ./ shell

Django Live Reloading Server

In separate terminals execute these commands and then navigate to http://localhost:8000/.

./ runserver
./ livereload

Build Docker

docker-compose build

Database migrations

Django keeps track of database migrations. When modifying models it is imperative to create and apply migrations on all old databases. Migrations can be safely removed if they have been applied to all independent databases (for that reason, it's probably better to just not remove them).

./ makemigrations
./ migrate

Note that this will try but not always succeed to detect renamed fields and such and migrate the backend database accordingly. If it is unable to, it may require manual intervention. For more information


# Run Tests
./ test
# Run Tests with Coverage
coverage run --source='.' test && coverage report

Database Backup & Restore


# Backup data, omit django internals (which could cause loading to fail)
./ dumpdata \
  -e contenttypes \
  -e admin \
  -e auth.Permission \
  --natural-foreign \
  --indent=2 \
    > mybackup.json


# Ensure database is initialized
./ migrate
# Load data from backup
./ loaddata mybackup.json


Secret values

For the docker-compose to work properly in production, /config/ should have the following files:

  • my.cnf: mysql configuration file with production database credentials
    • This file can be specified with MYSQL_CONFIG environment variable
  • secret.txt: Secret key for production (random private string of characters)
  • cert.key: SSL Private Key (optional, for https)
  • cert.crt: SSL CA Signed Public Key (optional, for https)


Can be configured by the administrator here. If using gmail, ensure you allow less secure apps.

Docker deployment

docker-compose up


MySQL issues

Errors involving mysql trying to load from /tmp/sock arrise when MYSQL_CONFIG environment variable is being read, but the file on the other end is problematic.

  1. You're not using an absolute path, so django, running perhaps elsewhere, can't find it. Try: export MYSQL_CONFIG=$(pwd)/ssl/my.cnf
  • Verify that it's accessible at the environment variable with cat $MYSQL_CONFIG
  1. Your configuration file has loose permissions, Try: chmod 644 ssl/my.cnf before trying again.
  2. Your configuration is malformed.

Database issues

In general, if the database has changed (and there are new migration files), if you're running a local database you may need to apply new migrations with ./ migrate.

No Cache Table

If the cache table doesn't yet exist, you can create it with ./ createcachetable.

Dependency issues

First try re-executing pip install -r requirements.txt.

In the worst case you may need to rebuild your environment from nothing (starting from scratch, and installing dependencies again).

I recommend pyenv for managing isolated python environments.