Setup your Dev environment¤
The following documentation assume your system meet the prerequisites.
Clone the repository¤
Load ASDF/Mise/Direnv (optional)¤
If you use ASDF, Mise (previously rtx) or Direnv, you can load the environment with:
Install dependencies with PDM¤
We assume you have
pdm
in your path. If you have installed it withpipx
, you can usepipx run pdm
instead.
A new virtualenv will be created in .venv
and dependencies will be installed.
Activate your venv¤
While you can use pdm run
to run commands, you can also activate your venv with:
Install pre-commit hooks (optional)¤
Set your .env¤
First, copy the .env.example
to .env
and edit it.
The first part of the .env
is just your choice of local development, and dependencies connection details.
Make sure to set the SECRET_KEY
to a random string.
You can already fill DJANGO_SUPERUSER_EMAIL
, DJANGO_SUPERUSER_USERNAME
and DJANGO_SUPERUSER_PASSWORD
to create a superuser.
Setup everything¤
You can start up the Postgres and Redis dependencies, apply migrations, load fixtures, create a superuser and collect static files with one shortcut:
What does it do?
It will perform the following steps:
- Launch dependencies with Docker
- Apply the database migrations
This PDM command uses the
migrate
command of Django to apply migrations on all enabled applications. If you enable a new app (switch PagerDuty on for the first time for instance), you'll need to apply migrations again.
- Load fixtures
This PDM command uses the
loaddata
command of Django to gather necessary objects (Severities, Components, Groups...)
- Create a superuser
This PDM command will use the env variables set earlier (
DJANGO_SUPERUSER_EMAIL
,DJANGO_SUPERUSER_USERNAME
andDJANGO_SUPERUSER_PASSWORD
) to create an admin user. Tou can use this user to login at http://127.0.0.1:8080/admin/
- Collect static files
Run the server¤
You should now be able to run the server locally with:
This PDM command uses the
runserver
command of Django.
You can login at http://127.0.0.1:8000/admin/ with the superuser you created.
Warning
If you run the server at this stage, you can expect some warnings/errors.