This project is An API and administrative tool for collecting quick user feedback across TNA sites, in the style of the GOV.UK feedback component.
See Key Concepts for further information.
This project uses the Django admin interface to manage feedback prompt questions and multiple choice answers, and decide which prompts are offered to users on which URLs. This is intended to be a temporary interface which will be replaced with a custom UI.
See Technical Guide for more technical information.
Use docker compose to run the server:
# Build and start the container
docker compose up -dFor development, you will need to run migrations:
docker compose exec app poetry run python /app/manage.py migrateYou will also need to create a superuser account:
docker compose exec app poetry run python /app/manage.py createsuperuserThen access the server at http://localhost:65527/ and login.
During the first time install, your app/static/assets directory will be empty.
As you mount the project directory to the /app volume, the static assets from TNA Frontend installed inside the container will be "overwritten" by your empty directory.
To add back in the static assets, run:
docker compose exec app cp -r /app/node_modules/@nationalarchives/frontend/nationalarchives/assets /app/app/staticdocker compose exec dev poetry run python /app/manage.py testdocker compose run dev ./format.shInstall dependencies through the app container:
docker compose exec app poetry add djangoThen sync your local dependencies, if desired:
poetry installManage migrations through the app container:
docker compose exec app poetry run python /app/manage.py makemigrations
docker compose exec app poetry run python /app/manage.py migrateIn addition to the base Docker image variables, this application has support for:
| Variable | Purpose | Default |
|---|---|---|
DJANGO_SETTINGS_MODULE |
The configuration to use | config.settings.production |
ALLOWED_HOSTS |
A comma-separated list of allowed hosts | none on production and staging, * on develop and test |
USE_X_FORWARDED_HOST |
Use the X-Forwarded-Host header in preference to Host |
False |
DEBUG |
If true, allow debugging | False |
COOKIE_DOMAIN |
The domain to save cookie preferences against | none |
DATABASE_URL |
The database's URL (postgres://USER:PASSWORD@HOST:PORT/NAME) |
none |
CSP_IMG_SRC |
A comma separated list of CSP rules for img-src |
'self' |
CSP_SCRIPT_SRC |
A comma separated list of CSP rules for script-src |
'self' |
CSP_SCRIPT_SRC_ELEM |
A comma separated list of CSP rules for script-src-elem |
'self' |
CSP_STYLE_SRC |
A comma separated list of CSP rules for style-src |
'self' |
CSP_STYLE_SRC_ELEM |
A comma separated list of CSP rules for style-src-elem |
'self' |
CSP_FONT_SRC |
A comma separated list of CSP rules for font-src |
'self' |
CSP_CONNECT_SRC |
A comma separated list of CSP rules for connect-src |
'self' |
CSP_MEDIA_SRC |
A comma separated list of CSP rules for media-src |
'self' |
CSP_WORKER_SRC |
A comma separated list of CSP rules for worker-src |
'self' |
CSP_FRAME_SRC |
A comma separated list of CSP rules for frame-src |
'self' |
GA4_ID |
The Google Analytics 4 ID | none |