Running the Flask Application
Start the Flask development server:- Sources the
environment.shfile to load environment variables - Runs
flask run -p 6012to start the server on port 6012
Auto-reload for Python Changes
In development mode (withFLASK_DEBUG=1 set in environment.sh), Flask automatically picks up Python code changes. You don’t need to restart the server when modifying Python files.
Frontend Development
For JavaScript and CSS development, run the frontend watch task in a separate terminal:- Sources the
environment.shfile - Runs
npm run watchto start Rollup in watch mode - Automatically rebuilds assets when you modify files in
app/assets/
Frontend Build Process
The frontend build uses Rollup (configured inrollup.config.mjs) to:
- Compile JavaScript from
app/assets/javascripts/ - Process SCSS stylesheets
- Copy static assets from GOV.UK Frontend
- Output bundled files to
app/static/
Running with Docker
If you prefer to use Docker for development:Build the Docker image
test target, tagging it as notifications-admin.Troubleshooting
Port Already in Use
If port 6012 is already in use, you’ll see an error when starting Flask. Find and stop the process using the port:Frontend Assets Not Loading
If static assets aren’t loading:- Check that
app/static/contains built files - Run
npm run buildto rebuild assets - Ensure
npm run watchis running if actively developing frontend code
Environment Variables Not Set
If you see errors about missing environment variables:- Verify
environment.shexists in the project root - Check that it contains all required variables
- Ensure the Makefile targets are sourcing it with
. environment.sh