This repository is used for the Dead Frontier 2 Wiki App developed using Wagtail.
- Python 3.11
On macOS (with Homebrew):brew install python3
- Poetry 1.1.11
curl -sSL https://install.python-poetry.org | python3 -
- PostgreSQL 14.0
On macOS (with Homebrew):brew install postgres
poetry install
This installs the libraries required for this projectpre-commit install
This installs pre-commit hooks to enforce code style.
sudo -u postgres psql
CREATE USER wiki WITH PASSWORD 'wiki';
ALTER USER wiki CREATEDB;
CREATE DATABASE wiki owner wiki;
- Copy
.env.example
to.env
and customize its values. SECRET_KEY
should be a random string, you can generate a new one using the following command:
python -c 'from secrets import token_urlsafe; print("SECRET_KEY=" + token_urlsafe(50))'
- Set
DATABASE_URL
topostgres://wiki:wiki@localhost/wiki
.
./manage.py migrate
This applies the migrations to your database./manage.py createsuperuser
This creates your superuser account. Just follow the prompts.
poetry shell
If it's activated you'll see the virtual environment name at the beginning of your prompt, something like("df2-wiki"-2wVcCnjv-py3.11)
../manage.py runserver
- Make sure you have a Redis server running on localhost with the default port (6379). More information on how to setup here
- Set the
CELERY_BROKER_URL
env var to redis://localhost:6379/0 celery -A agfirst worker -l info
This starts a Celery worker that will process the tasks defined in the agfirst application.celery -A agfirst beat -l info
This starts the Celery beat scheduler that will schedule and trigger periodic tasks defined in the agfirst application.
poetry shell
pytest
Runpytest --cov=. --cov-report term-missing
to also show coverage report.
- Changing the
.env
file variables has no effect.
Runexport $(grep -v '^#' .env | xargs -0)
to source the file
or
Exit shell and runpoetry shell
again to reload the env file