# macOS
brew install just
# Linux
# Install from https://github.com/casey/just/releases
# Add completion for your shell. E.g. for bash:
source <(just --completions bash)
# Show all available commands
just # shortcut for just --list
- Python v3.10.x
- virtualenv
- pip
- Docker (for running postgres)
- Node.js v16.x (fnm is recommended for Node.js and npm)
- npm v7.x
Set up a local development environment with:
just devenv
See the Compiling assets section.
Run the tests with:
just test <args>
just run
By default, the justfile
will use the configuration in docker/docker-compose.yaml
to run a local dev postgres instance.
You can use the normal ./manage dbshell
will provide psql console if needed.
This project uses Vite, a modern build tool and development server, to build the frontend assets. Vite integrates into the Django project using the django-vite package.
Vite works by compiling JavaScript files, and outputs a manifest file, the JavaScript files, and any included assets such as stylesheets or images.
Vite adds all JavaScript files to the page using ES6 Module syntax. For legacy browsers, this project is utilising the Vite Legacy Plugin to provide a fallback using the module/nomodule pattern.
For styling this project uses Scss to compile the stylesheets, and then PostCSS for post-processing.
Vite has a built-in development server which will serve the assets and reload them on save.
To run the development server:
- Update the
.env
file toDJANGO_VITE_DEV_MODE=True
- Open a new terminal and run
npm run dev
This will start the Vite dev server at localhost:3000 and inject the relevant scripts into the Django templates.
To view the compiled assets:
- Update the
.env
file toDJANGO_VITE_DEV_MODE=False
- Run
just assets-rebuild
Vite builds the assets and outputs them to the assets/dist
folder.
Django Staticfiles app then collects the files and places them in the staticfiles/bundle
folder, with the manifest file located at staticfiles/bundle/manifest.json
.
- Log into the
opensafely-interactive-bot
GitHub account (credentials are in Bitwarden). - Got to the Personal access tokens (classic) page.
- Click on
opensafely-interactive-token
. - Click "Regenerate token".
- Set the expiry to 90 days.
- Copy the new token.
- ssh into
dokku3.ebmdatalab.net
- Run:
dokku config:set interactive GITHUB_TOKEN=<the new token>