Setup
Prerequisites:
- This project uses pdm ⧉ as package manager
- A Postgres DB v14+
- A Redis server
Note
PDM will create a virtualenv in
Create virtualenvironment
-
Checkout code
git clone https://github.com/unicef/hope-aurora git config branch.autosetuprebase always
-
In the shell:
pdm venv create pdm use pdm venv activate
-
Check your virtualenv is properly created
pdm info
-
Install the package
pdm install pdm run pre-commit install
-
Add
export PYTHONPATH="$PYTHONPATH:./src"
-
Check your environment:
./manage.py env --check
and configure the missing variables.Hint
You can generate a list for your development environment with the command
./manage.py env --develop --config --pattern='export {key}={value}'
-
Run upgrade command to properly initialize the application:
./manage.py upgrade --admin-email ${ADMIN_EMAIL} --admin-password ${ADMIN_PASSWORD}
Note
Django migrations and collectstatic commands are automatically included in this step
Configure environment for .direnv
If you want to use direnv ⧉ and automatic loading of environment variables from a .envrc file:
./manage.py env --develop --config --pattern='{key}={value}' > .envrc
echo 'export PYTHONPATH="$PYTHONPATH:./src"' >> .envrc
echo 'eval $(pdm venv activate)' >> .envrc
echo "unset PS1" >> .envrc
Warning
The first time after you have created or modified the .envrc file you will have to authorize it using:
direnv allow