Django-based front-end for the modelling Web Lab
The easiest way to get a complete working Web Lab setup is to use the developer version of our Ansible deployment. See https://github.com/ModellingWebLab/deployment for details.
This VM can also be used to run experiments with a local Django server for development.
If you want to install Django locally for development purposes, read on...
pip install -r requirements/base.txt
or, for local dev setup:
pip install -r requirements/dev.txt
To run social login, you will need to set up apps on Google and/or GitHub:
You can set these up via environment variables:
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET
SOCIAL_AUTH_GITHUB_KEY
SOCIAL_AUTH_GITHUB_SECRET
The --createdb flag should be set for the database user if running tests (so test databases can be set up and torn down). This should not be done on a production system.
createuser weblab --createdb
createdb -O weblab weblab
weblab/manage.py migrate
weblab/manage.py createsuperuser
python weblab/manage.py runserver
$ sudo npm install -g gulp-cli
$ cd static
$ npm install
$ gulp
By default, gulp
will just build the required static files.
gulp watch
will watch the files for changes and rebuild when necessary.
The Ansible deployment will install the XML/RDF file from https://github.com/ModellingWebLab/ontologies into the appropriate locations for both front-end and back-end on the VM, which will suffice for running experiments. (This is what happens on the production systems.)
If you wish to have the latest annotations available in the metadata editor on your local development setup, you can copy oxford-metadata.rdf
from that repository into weblab/static/js/visualizers/editMetadata
.
cd weblab
pytest
If you encounter database access issues, you may need to give the weblab user rights to create databases:
sudo -u postgres psql postgres
ALTER USER weblab CREATEDB;
When running these tests in a vagant VM (using the vagant file & ansible playbook provided in deployment: Edit pytest.ini and change DJANGO_SETTINGS_MODULE to:
DJANGO_SETTINGS_MODULE=config.settings.vagrant
Make sure not to commit the modified pytest.ini!