NB Public repo. So avoid pushing secrets...
CMS and REST API built using Wagtail. It runs on http://localhost:8000 by default. With admin pages exposed on http://localhost:8000/admin and API exposed at http://localhost:8000/api/v2/
For actual production usage we will most likely rely entierly on REST API, so consider all templates and html views test/dev only.
Initial site following structure as outlined in official Getting Started tutorial. So check that out for a quick introduction into how contents are structured.
Example urls
We are mainly using Docker via docker-compose for local development (using poetry for dependency management inside the web
container). To get started
- Copy
.env.example
to.env
- Start apps via
docker compose up
- Wait until apps are running, and calmed down
- Create admin user via
make createsuperuser
- Manually create site content and config, or use
make seed-for-development
to create basic setup with dummy content (not safe to use if content has already been added)
Once running you should start an interactive shell in web
container in order to have full access to any Django and Wagtail commands. This can be done via docker compose exec web bash
, or via our shortcut make
/make shell
We recommend this approach since it makes it a lot easier to tinker and learn how things work. To list all commands available try python manage.py
(while in the interactive shell)
We use pre-commit for making sure all code conforms to the same formatting. This happens automatically on commit after this first time setup.
- Install Pre-commit (Usually
pip install pre-commit
orbrew install pre-commit
) - Activate it via
pre-commit install
PS. If running code locally instead of in container, poetry installs pre-commit as a dev dependency, so you can run poetry run pre-commit install
instead.
Site should follow expected Wagtail and Django patterns if nothing else is mentioned.
- We allow for scheduled content, so make sure to run
publish_scheduled
command every x minutes
Use python manage.py test
in container, or make test
locally to run test suite. We generally try to rely on Wagtail and Djange framework as much as possible, but feel free to test custom behaviour/code and add sanity checks.
Having test coverage will be helpful when debugging issues or figuring out how existing code was intended to behave (aka. answering the age old question of, is current behaviour a bug or just an unknown feature?).
This repo is developed and maintained by the Systemstøtte crew at The Gathering. Once we get further along PR will be accepted, for now either apply to join our crew or reach out to us via issues before spending any time on development.
It is very possible to run the project locally without Docker. We use poetry for dependency management with poetry-dotenv-plugin to load .env variables. It should automatically make sure python runs in a virtual environment with the correct dependencies, but this method will always require a bit more local management.
- Install
poetry
(we recommend usingpipx
for this, viapipx install poetry
) - Install dependencies by running
poetry install
- Install
pre-commit
hooks by runningpoetry run pre-commit install
- Configure and run a local posgres via your method of choice
- Copy
.env.example
to.env
and updatePOSTGRES_*
variables to match your local setup
- Run
poetry run python manage.py runserver
to start the development server - Run
poetry run python manage.py migrate
to apply migrations - Run
poetry run python manage.py createsuperuser
to create a superuser
You can use poetry env activate
to source poetry env in current shell, if you want to avoid prefixing commands with poetry run
.