$ git clone https://github.com/uktrade/directory-api
$ cd directory-api
$ virtualenv .venv -p Python3.9.2
$ source .venv/bin/activate
$ make install_requirements
Secrets such as API keys and environment specific configurations are placed in conf/env/secrets-do-not-commit
- a file that is not added to version control. To create a template secrets file with dummy values run make secrets
.
Command | Description |
---|---|
make clean | Delete pyc files |
make pytest | Run all tests |
make pytest test_foo.py | Run all tests in file called test_foo.py |
make pytest -- --last-failed` | Run the last tests to fail |
make pytest -- -k foo | Run the test called foo |
make pytest -- | Run arbitrary pytest command |
make manage | Run arbitrary management command |
make webserver | Run the development web server |
make requirements | Compile the requirements file |
make install_requirements | Installed the compile requirements file |
make css | Compile scss to css |
make secrets | Create your secret env var file |
make worker | Run the celery worker |
make beat | Run the celery beat scheduler |
make checks | Run isort, black and flake8 in check-only mode |
make autoformat | Run isort, black and flake8 in update-files mode |
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.
Linux (Fedora 27) instructions are available here
https://github.com/uktrade?q=directory https://github.com/uktrade?q=great