Create a python virtualenv then run:
make init
Create a local development postgres db
createdb config_manager
Create or update db schema
make upgrade-db
Load data
make load-data
Drop local data
make drop-data
To run the application run:
make run
To test out github app integration locally you need to set the following in a .env file:
GITHUB_CLIENT_ID=[the id]
GITHUB_CLIENT_SECRET=[the secret]
GITHUB_APP_ID=[github app id]
GITHUB_APP_PRIVATE_KEY=[base64 encoded private key for github app]
CONFIG_BRANCH=[the config repo brach this app pushes to]
Speak to @ashimali about where to find the above
This project uses pip-tools to manage requirements files. https://pypi.org/project/pip-tools/
When using fresh checkout of this repository, then make init will take care of the initial of packages from the checked in requirements and dev-requirements files.
These instructions are only for when you add new libraries to the project.
To add a production dependency to the main aapplication, add the package to the requirements.in file.
Then run the piptools compile command on the "in" file:
python -m piptools compile requirements/requirements.in
That will generate a new requirements.txt file in the requirements directory.
To add a development library, add a line to dev-requirements.in.
Note that the first line of that file is:
"-r requirements.txt" which constrains the versions of dependencies in the requirements.txt file generated in previous step.
python -m piptools compile requirements/dev-requirements.in
Then to install all the packages run:
python -m piptools sync requirements/requirements.txt requirements/dev-requirements.txt
This project uses the @planning-data/digital-land-frontend npm package to manage frontend asset compilation and copying.
The build process uses nps (npm-package-scripts) to organize build tasks. The base scripts come from digital-land-frontend, with project-specific overrides in package-scripts.js.
- SASS: Compiles SCSS to CSS
- Rollup: Bundles custom JavaScript files
- copyfiles: Copies vendor assets (govuk-frontend, accessible-autocomplete)
Build all assets (runs automatically after npm install):
npm run buildWatch for changes during development:
npm run watchCopy vendor assets:
npm run copyAll static assets are generated during build and output to application/static/:
application/static/stylesheets/- Compiled CSSapplication/static/javascripts/- Bundled JSapplication/static/images/- Image assetsapplication/static/govuk/- GOV.UK Frontend assets
These directories are git-ignored and should never be committed.
The package-scripts.js file extends digital-land-frontend with:
- Override for govuk-frontend v5 asset paths (fixes compatibility issue)
- Custom vendor asset copying (accessible-autocomplete, MOJ components)
- GOV.UK Frontend JavaScript bundle
See the comments in package-scripts.js for details on why these overrides are necessary.
Frontend build paths are configured in digital-land-frontend.config.json.