- install python3.11 and postgresql as specified here
setup virtualenv
In repo root,
python -m venv venv
venv\Scripts\activate
(windows) orsource venv/bin/activate
(linux)pip install -r requirements.txt -r requirements_dev.txt
Set up DB and user
- psql -U postgres -c "CREATE ROLE sample_db_user with login"
- psql -U postgres -c "ALTER ROLE sample_db_user createdb"
- createdb -U sample_db_user sample_db
populate DB
python manage.py migrate
python manage.py loaddata my_app/fixtures/lookups.yaml
python manage.py runscript my_app.scripts.dev
In the case your CI is failing due to formatting issues, you can run the following commands to fix them all.
isort src --settings-path pyproject.toml
black src/ --config pyproject.toml
djlint --reformat src --configuration pyproject.toml
TODO: consider making this a cookie-cutter template? Might not be worth it...
- Delete the my_app stuff,
- my_app dir
- tests/my_app/
- loaddata and runscript steps in populate-db instructions above
- use
django-admin startapp <newapp>
to create your own app (or do this later) - Replace the following strings (search/replace) everywhere, including your .env and this README
my_app
-><newapp>
sample_db
-><your_db_name>
sample_db_user
-><your_db_user>
sample_db_test
-><your_db_test_name>
(just add_test
as a suffix to DB name)
- Follow the instructions in the "Configuring dev environment" section above and check that everything works
- Delete this section and the next section of the README
- remove the .env file from the repo (you probably want to keep it locally though, maybe
git rm –cached .env
?)
- HTMX example w/ project tasks, maybe multiple examples
- extract utils into phac-helpers
- Add excel export