$ git clone https://github.com/uktrade/directory-api
$ cd directory-api
$ virtualenv .venv -p python3.6
$ source .venv/bin/activate
$ pip install -r requirements_test.txt
Secrets such as API keys and environment specific configurations are placed in conf/.env
- a file that is not added to version control. You will need to create that file locally in order for the project to run.
$ source .venv/bin/activate
$ make debug_webserver
$ make debug_test
For development efficiency a dummy company can be loaded into the database from fixtures/development.json
. To do this run:
$ make loaddata
To update fixtures/development.json
with the current contents of the database run:
$ make dumpdata
Then check the contents of fixtures/development.json
.
Run debug celery beat scheduler Requires Redis (e.g. Install and config Redis on Mac OS X via Homebrew for the Mac)
$ make debug_celery_beat_scheduler
Some tasks as executed asynchronously such as sending confirmation emails:
$ make debug_celery_worker
To make sso work locally add the following to your machine's /etc/hosts
:
IP Adress | URL |
---|---|
127.0.0.1 | buyer.trade.great |
127.0.0.1 | supplier.trade.great |
127.0.0.1 | sso.trade.great |
127.0.0.1 | api.trade.great |
127.0.0.1 | profile.trade.great |
127.0.0.1 | exred.trade.great |
Then log into directory-sso
via sso.trade.great:8004
Note in production, the directory-sso
session cookie is shared with all subdomains that are on the same parent domain as directory-sso
. However in development we cannot share cookies between subdomains using localhost
- that would be like trying to set a cookie for .com
, which is not supported by any RFC.
Therefore to make cookie sharing work in development we need the apps to be running on subdomains. Some stipulations:
directory-ui-supplier
anddirectory-sso
must both be running on sibling subdomains (with same parent domain)directory-sso
must be told to target cookies at the parent domain.
Create registered company in your local environment:
cmd="create_registered_company ch_id_max_8chrs" make debug_manage
Linux (Fedora 27) instructions are available here
https://github.com/uktrade?q=directory https://github.com/uktrade?q=great