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...
Install system requirements
- Python 3.6+
- Postgres 9.4+ (with dev headers)
- NodeJS 8.x / NPM 5.x (to build static files)
Install requirements into virtualenv
pip install -r requirements/base.txt
or, for local dev setup:
pip install -r requirements/dev.txt
Create social apps
To run social login, you will need to set up apps on Google and/or GitHub:
- Google OAuth2: http://code.google.com/apis/accounts/docs/OAuth2.html#Registering
- GitHub: https://github.com/settings/applications/new
You can set these up via environment variables:
Create Postgres (user &) database
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
Create initial admin user account
python weblab/manage.py runserver
$ sudo npm install -g gulp-cli $ cd static $ npm install $ gulp
gulp will just build the required static files.
gulp watch will watch the files for changes and rebuild when necessary.
Install latest ontology for metadata editor
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
Run unit tests (needs requirements installed e.g. in virtual environment)
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:
Make sure not to commit the modified pytest.ini!