This guide covers setting up both the backend (ds-wagtail) and frontend (wa-frontend) repositories for local development.
git clone git@github.com:nationalarchives/ds-wagtail.gitdocker compose up -dcp docker-compose.override.yml.example docker-compose.override.ymlDuring 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 app poetry run python -m pytestdocker compose exec app formatIn addition to the base Docker image variables, this application has support for:
| Variable | Purpose | Default |
|---|---|---|
CONFIG |
The configuration to use | config.Production |
DEBUG |
If true, allow debugging[^1] | False |
COOKIE_DOMAIN |
The domain to save cookie preferences against | 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_STYLE_SRC |
A comma separated list of CSP rules for style-src |
'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' |
CSP_FRAME_ANCESTORS |
A comma separated list of CSP rules for frame-accestors |
'self' |
CSP_FEATURE_FULLSCREEN |
A comma separated list of rules for the fullscreen feature policy |
'self' |
CSP_FEATURE_PICTURE_IN_PICTURE |
A comma separated list of rules for the picture-in-picture feature policy |
'self' |
CSP_REPORT_URL |
The URL to report CSP violations to | none |
FORCE_HTTPS |
Redirect requests to HTTPS as part of the CSP | none |
CACHE_TYPE |
https://flask-caching.readthedocs.io/en/latest/#configuring-flask-caching | none |
CACHE_DEFAULT_TIMEOUT |
The number of seconds to cache pages for | production: 300, staging: 60, develop: 0, test: 0 |
CACHE_DIR |
Directory for storing cached responses when using FileSystemCache |
/tmp |
GA4_ID |
The Google Analytics 4 ID | none |
ARCHIVE_JSON_URL |
URL to fetch archive data JSON from (used by sync-archive-data command) | none |
SQLALCHEMY_DATABASE_URI |
Database connection string | sqlite:///app.db |
WAGTAIL_API_URL |
The base URL of the content API, including the /api/v2 path |
none |
WAGTAIL_API_KEY |
A token used to access the Wagtail API | none |
WAGTAIL_SITE_HOSTNAME |
The site hostname in Wagtail, the default site is used if none is specified | none |
Note: Due to the way the
requestslibrary handles redirects, theAuthorizationheader is stripped when following a redirect that involves an HTTP to HTTPS protocol change. This means that connecting to a live (HTTPS) Wagtail API from a local HTTP development environment may result in a403 Forbiddenresponse. This behaviour will not be worked around as doing so would introduce security risks by potentially sending credentials over an unencrypted connection.
[^1] Debugging in Flask