It is now recomended users download the entire AIMS stack including the UI and API bundled together with pre-loaded example address data from https://github.com/ONSdigital/aims-diy as it's the easiest way to see the UI in action.
The UI can be run without an API, however many features that require the API will not work as intended.
Therefore if you want to run the UI locally you will need to connect it to an instance of AIMS. It is recomended you use the bundled version of the API from https://github.com/ONSdigital/aims-diy while commenting out the "UI" portion of the docker-compose.
Pre-requisites:
- Access to an API as described above
- Python 3.12.1
Environment Variable | Value | Command |
---|---|---|
export FLASK_APP |
"aims_ui" |
export FLASK_APP="aims_ui" |
export FLASK_ENV |
"development" |
export FLASK_ENV="development" |
export API_AUTH_TYPE |
"JWT" |
export API_AUTH_TYPE="JWT" |
export API_JWT_TOKEN |
[enter_jwt_token_here] |
export API_JWT_TOKEN="[enter_jwt_token_here]" |
export BM_API_URL |
[enter_bulk_match_url] |
export BM_API_URL="[enter_bulk_match_url]" |
export BM_JWT_TOKEN |
[enter_jwt_token_here] |
export BM_JWT_TOKEN="[enter_jwt_token_here]" |
export API_JWT_K_VALUE |
`[enter_API_JWT_K_VALUE_here] | export API_JWT_K_VALUE="NA" |
export API_BSC_AUTH_USERNAME |
[enter_bsc_username] |
export API_BSC_AUTH_USERNAME="[enter_bsc_username]" |
export API_BSC_AUTH_PASSWORD |
[enter_bsc_password] |
export API_BSC_AUTH_PASSWORD="[enter_bsc_password]" |
export PROJECT_DOMAIN |
[enter_project_domain] |
export PROJECT_DOMAIN="[enter_project_domain]" |
Note: JWT token is exported WITHOUT 'Bearer ' before it |
Set the "groups" of users (by default all users including the "NotLoggedInUser" are in the "default" group
export USER_AUTHS='{"developers":["NotLoggedinUer"]}'
pip install -r requirements.txt
If running tests as well
pip install -r requirements_test.txt
pip install -e .
python3 -m flask run
python3 run_ui_developer.py
yapf --style='{based_on_style: pep8, indent_width: 2}' -ir .
- Pre-requisites:
pip install isort
pip install autoflake
autoflake --in-place --remove-all-unused-imports --remove-unused-variables \"${file}\"
isort \"${file}\
This will remove unused imoports and organise imports consistantly
npm run lint
- Ensure the API is up and running on port 9001
- Run the UI with the wsgi.py script
python wsgi.py
- Headless:
python3 -m pytest tests/pytest_tests -n 4
- Visible:
python3 -m pytest tests/pytest_tests --browser chromium --slowmo 2000 --headed
npm run test:jest
FOR WINDOWS USERS ONLY:
Ensure you have python 3.9 installed
Run a command window as an administrator and cd to the project root
pip install -r requirements.txt
Download the design system templates from https://github.com/ONSdigital/design-system/releases
Unzip the components and layout directories into the project's templates folder
Set environment variables and run (on localhost:5000)
set FLASK_ENV=development
set FLASK_APP=src/aims_ui
python -m flask run
- Note that the above is for Command Prompt not Powershell - use
$Env:<variable-name>
for powershell launch