Export Readiness (Exred) - the Department for International Trade (DIT)
directory-api | directory-ui-buyer | directory-ui-supplier | directory-ui-export-readiness |
---|---|---|---|
directory-sso | directory-sso-proxy | directory-sso-profile |
For more information on installation please check the Developers Onboarding Checklist
We aim to follow GDS service standards and GDS design principles.
We use SASS CSS pre-compiler. If you're doing front-end work your local machine will also need the following dependencies:
$ gulp test
$ npm test
.env
files will be automatically created (with env_writer.py
based on env.json
) by make docker_test
, based on host environment variables with DIRECTORY_UI_EXPORT_READINESS_
prefix.
$ git clone https://github.com/uktrade/directory-ui-export-readiness
$ cd directory-ui-export-readiness
$ virtualenv .venv -p python3.5
$ source .venv/bin/activate
$ pip install -r requirements_test.txt
$ source .venv/bin/activate
$ make debug_webserver
$ make debug_test
When doing front-end development work you will need to be able to compile SASS to CSS. First run:
$ npm install
Then:
$ gulp sass
...to compile sass. You can also watch for changes by running:
$ gulp sass:watch
We add compiled CSS files to version control. This will sometimes result in conflicts if multiple developers are working on the same SASS files. However, by adding the compiled CSS to version control we avoid having to install node, npm, node-sass, etc to non-development machines.
You should not edit CSS files directly, instead edit their SCSS counterparts.
Signed cookies are used as the session backend to avoid using a database. We therefore must avoid storing non-trivial data in the session, because the browser will be exposed to the data.
Follow the Django documentation
To create or update .po
files:
$ make debug_manage cmd="makemessages"
To compile .mo
files (no need to add these to source code, as this is done automatically during build):
$ make debug_manage cmd="compilemessages"
This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.
To download the data run the following command:
$ make debug_manage cmd="download_geolocation_data"
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:8001
, and use directory-ui-export-readiness
on exred.trade.great:8001
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-export-readiness
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.