Part of GOV.UK Notify
Frontend app for the Notify API
Python app, based on the Flask framework
This is done through pip and virtualenv. In practise we have used VirtualEnvWrapper for our virtual environemnts.
Setting up a virtualenvwrapper for python3
mkvirtualenv -p /usr/local/bin/python3 notify-frontend
You need to run these commands every time you restart your terminal window -- this includes new terminal tabs and panes. To avoid this, you can add environment variables
To use your local API instance:
export DM_DATA_API_URL=http://localhost:5000
export DM_DATA_API_AUTH_TOKEN=<bearer_token>
To use the test instance on heroku:
export NOTIFY_API_URL=https://test-notify-api.herokuapp.com/
export NOTIFY_DATA_API_AUTH_TOKEN=<bearer_token>
Install new Python dependencies with pip
pip install -r requirements_for_test.txt
Install frontend dependencies with npm and gulp
npm install
For development usage:
npm run frontend-build:development
For production:
npm run frontend-build:production
npm run frontend-build:watch
./scripts/run_tests.sh
To run the Admin Frontend App for local development you can use the convenient run script, which sets the required environment variables to defaults if they have not already been set:
./scripts/run_app.sh
More generally, the command to start the server is:
python application.py runserver
The admin frontend runs on port 5004. Use the app at http://127.0.0.1:5004/
To use feature flags, check out the documentation in (the README of) digitalmarketplace-utils.
NPM is used for all frontend build tasks. The commands available are:
npm run frontend-build:development
(compile the frontend files for development)npm run frontend-build:production
(compile the frontend files for production)npm run frontend-build:watch
(watch all frontend files & rebuild when anything changes)npm run frontend-install
(install all non-NPM dependancies)
Note: npm run frontend-install
is run as a post-install task after you run npm install
.
source ./venv/bin/activate
export DM_DATA_API_URL=http://localhost:5000
export DM_DATA_API_AUTH_TOKEN=<bearer_token>
or
export NOTIFY_API_URL=https://test-notify-api.herokuapp.com/
export NOTIFY_DATA_API_AUTH_TOKEN=<bearer_token>
pip install -r requirements_for_test.txt
npm install
npm run frontend-build:watch
./scripts/run_app.sh
See API and API Client repos for more information```