ModellingWebLab / WebLab

Django-based front-end for the modelling Web Lab v2
Other
3 stars 2 forks source link

WebLab

Django-based front-end for the modelling Web Lab

Build Status

Setup

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

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:

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

Apply migrations

weblab/manage.py migrate

Create initial admin user account

weblab/manage.py createsuperuser

Run server

python weblab/manage.py runserver

Build statics

$ 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.

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 weblab/static/js/visualizers/editMetadata.

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:

DJANGO_SETTINGS_MODULE=config.settings.vagrant

Make sure not to commit the modified pytest.ini!