The dashboard is run in a DevContainer via Docker. The DevContainer VSCode extension is recommended, as is Docker Desktop.
For more information on Dev Containers, see the Analytical Platform docs.
To build the dev container, ensure docker desktop is running, then open the AP UI project in VSCode. Open the command pallet by hitting command+shift+p and search for Dev Containers: Reopen in container
and hit enter. This will build the dev container.
If you are using a workspace with multiple applications, search for Dev Containers: Open folder in Container…
instead, then select the AP UI folder. Once the dev container has finished building, it should install all the required Python and npm dependencies, as well as run the migrations.
There is an example environment file stored on 1Password named Analytical Platform UI Env
. Paste the contents into a new file called .env
in the root of the project.
To run the server, you will need to use aws-sso cli. To find the correct profile, run aws-sso list
in the terminal. This will provide you with a link to sign in via SSO. Once signed in, a list of profiles will be displayed. You are looking for the profile name linked to the analytical-platform-compute-development
AccountAlias.
To run the server using this profile, enter aws-sso exec --profile analytical-platform-compute-development:modernisation-platform-sandbox -- python manage.py runserver
or make serve-sso
. Then go to localhost:8000
and sign in using your @justice.gov.uk identity.
Copy launch.json.example
, settings.json.example
and tasks.json.example
from the examples folder into a .vscode
folder in the root of the project and remove the .example
suffix. To debug the application, go to the run and debug
tab and select the runserver
configuration. When starting debugging you may need to sign into AWS first. There will be a prompt in the terminal to do so.
To debug any tests, switch the debug configuration to Python: Debug Tests
then go to the testing tab. From here you can run the full suite of tests or individual tests. You can also click the debug icon in order to debug any tests that are failing.
To run the migrations locally, run python manage.py migrate
in the terminal.
To build the static assets, run make build-static
in the terminal.