Web client interface for Open Concept Lab terminology services API.
-
ocl_web
- Fork the repo on Github
- Clone your fork locally
git clone https://github.com/{youruser}/ocl_web.git
- Add a remote repo to upstream in order to be able to fetch updates:
cd ocl_web git remote add upstream https://github.com/OpenConceptLab/ocl_web
-
python
-
npm
-
pip
-
python virtualenv
pip install virtualenv
- OCL API must be setup, up and running.
-
Change working directory to repository root
cd ocl_web
-
Create a virtualenv for the project (NOTE: "env" is the name of virtualenv by convention, but you can give it any name, just be sure to add it to the ignores list in git)
virtualenv env #Creates a virtual environment
-
Create the file that will be used as the DB for ocl_web
touch ocl.db
-
Activate the virtual environment created in step 2 . For deactivation of virtual env just write 'deactivate'. (NOTE: Replace "env" with the directory name you used to create your virtual environment)
source ./env/bin/activate
-
Set the environment variables below to let OCL Web connect to API and set the DB location. Note that OclAPI must be already setup for this, you can see the token at http://0.0.0.0:8000/admin/authtoken/token/ (8000 is the port where oclapi server is running). Note that for a local development environment, OCL_API_HOST will typically be set to
http://localhost:8000
.export OCL_API_HOST='<your_api_server_ip>' export OCL_API_TOKEN='<root_token_from_api>' export OCL_ANON_API_TOKEN='<root_token_from_api>' export DATABASE_URL=sqlite:////<OCL_WEB_ROOT>/ocl.db
-
Install python and node.js dependencies -- NOTE: Make sure your version of pip in your virtualenv is up-to-date (e.g. pip install --upgrade pip)
pip install -r requirements/local.txt npm install
-
Install grunt cli
npm install -g grunt-cli
-
Prepare database (create tables for models and apply migrations)
python ocl_web/manage.py syncdb #You will be prompted to create an ocl_web superuser python ocl_web/manage.py migrate
-
Create a user. Make sure to get status=201 on the output. Otherwise the user is not created.
python ocl_web/manage.py create_test_user --username <username> --password <password>
-
Serve the application
grunt serve
- Application should be up at http://localhost:7000 and you should be able to login with the user created in step 9
OCL_WEB has a suite of unit tests written in python (django test) and end-to-end tests written in protractor running either headless (PhantomJS) or Chrome.
- Unit Tets
python ocl_web/manage.py test
- Running E2E tests
- Headless on showcase server:
./run_ui_tests.sh
- Locally on Chrome:
OCL_WEB=. browser=phantomjs env=local username=<username> password=<pwd> ./run_ui_tests.sh
cookiecutter-django relies extensively on environment settings which will not work with Apache/mod_wsgi setups. It has been deployed successfully with both Gunicorn/Nginx and even uWSGI/Nginx.
For configuration purposes, the following table maps the cookiecutter-django environment variables to their Django setting:
Environment Variable | Django Setting | Development Default | Production Default |
---|---|---|---|
DJANGO_AWS_ACCESS_KEY_ID | AWS_ACCESS_KEY_ID | n/a | raises error |
DJANGO_AWS_SECRET_ACCESS_KEY | AWS_SECRET_ACCESS_KEY | n/a | raises error |
DJANGO_AWS_STORAGE_BUCKET_NAME | AWS_STORAGE_BUCKET_NAME | n/a | raises error |
DJANGO_CACHES | CACHES | locmem | memcached |
DJANGO_DEBUG | DEBUG | True | False |
DJANGO_EMAIL_BACKEND | EMAIL_BACKEND | django.core.mail.backends.console.EmailBackend | django.core.mail.backends.smtp.EmailBackend |
DJANGO_SECRET_KEY | SECRET_KEY | CHANGEME!!! | raises error |
DJANGO_SECURE_BROWSER_XSS_FILTER | SECURE_BROWSER_XSS_FILTER | n/a | True |
DJANGO_SECURE_SSL_REDIRECT | SECURE_SSL_REDIRECT | n/a | True |
DJANGO_SECURE_CONTENT_TYPE_NOSNIFF | SECURE_CONTENT_TYPE_NOSNIFF | n/a | True |
DJANGO_SECURE_FRAME_DENY | SECURE_FRAME_DENY | n/a | True |
DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS | SECURE_HSTS_INCLUDE_SUBDOMAINS | n/a | True |
DJANGO_SESSION_COOKIE_HTTPONLY | SESSION_COOKIE_HTTPONLY | n/a | True |
DJANGO_SESSION_COOKIE_SECURE | SESSION_COOKIE_SECURE | n/a | False |
- TODO: Add vendor-added settings in another table
Copyright (C) 2016 Open Concept Lab. Use of this software is subject to the terms of the Mozille Public License v2.0. Open Concept Lab is also distributed under the terms the Healthcare Disclaimer described at http://www.openconceptlab.org/license/.