- Python 3.9+
- PostgreSQL 16 (important note: Postgres 17+ is NOT SUPPORTED) with
postgisextension enabled (see below) - virtualenv
- Docker Desktop (required on Windows, optional everywhere else)
- PyCharm (recommended) or any IDE of your choice
- Install PostgreSQL (versions 17+ are NOT SUPPORTED) with
pg_config(PostgreSQL dev tools) - Install GDAL
# On MacOS
brew install gdal# On Linux
sudo apt-get update
sudo apt-get install libgdal-dev- Create database on your system and enable
postgisextension
sudo -u postgres psql
CREATE USER bg_user WITH PASSWORD 'bg_password';
ALTER USER bg_user CREATEDB;
CREATE DATABASE boardgamers OWNER bg_user;
\q
sudo -u postgres psql boardgamers
CREATE EXTENSION postgis;
\q- Make a copy of
.env_template, name it.env, and add the right values. - Activate virtual environment and install project's dependencies
source venv/bin/activate
pip install
- Run migrations
python manage.py migrate- Run Django Server
python manage.py runserverheroku pg:psql DATABASE_URL -a example-app
CREATE EXTENSION postgis;
Heroku docs HERE
Add the buildpack:
heroku buildpacks:add --index 1 heroku-community/aptHeroku docs HERE
For local development, emails are sent via Mailtrap, an SMTP sandbox that captures outgoing emails without delivering them.
- Sign up at mailtrap.io and create an inbox
- Copy the SMTP credentials from your inbox and add them to
.env:EMAIL_HOST=sandbox.smtp.mailtrap.io EMAIL_HOST_USER=<your-user> EMAIL_HOST_PASSWORD=<your-password> EMAIL_PORT=2525 - All emails sent by the app will appear in your Mailtrap inbox
In production, replace these with your SMTP provider credentials (e.g. AWS SES).
To avoid to generate po file for dependencies, run:
python manage.py makemessages -l it -i "venv/*" -i "static/*" -i "migrations/*" -i "node_modules/*"
Add your translations, then, in order to compile locales run:
python manage.py compilemessages
-
Copy the file
.env_templateand rename it to.env. -
Open
.envand update the database host:
DB_HOST=dbThis is required because Docker containers communicate using service names, not .localhost.
From the project root, run:
docker compose up -dThis command will:
- Build the Docker images
- Start the Django container (
.web) - Start the PostgreSQL + PostGIS container (
.db) - Apply migrations automatically
Wait until both of the cointainers are built. You can verify their status with:
docker compose psEnter the web container:
docker compose exec web bashInside the container, run the following command to populate the database:
python manage.py populate_dbThe following steps are recommended for proper debugging and execution using PyCharm.
Go to:
Settings → Project → Python Interpreter → Add InterpreterSelect:
Docker ComposeThen configure:
- Compose file:
.docker-compose.yml - Service:
.web - Python interpreter path: keep default
- Environment variables: keep default
Click Next and then Apply.
PyCharm will now use Python directly from the Docker container.
If the containers are already running:
- Simply press the Run
▶️ or Debug 🐞 button in PyCharm.
If containers are not running, start them first using one of the following options:
docker compose up -dor via Docker Desktop UI.
Once Django is running, open your browser:
http://localhost:8000- Django runs inside Docker, not on your local machine.
- Always use 0.0.0.0:8000 inside containers.
- If environment variables change, restart containers:
docker compose up -d- If Dockerfile or dependencies change:
docker compose up -d --buildIf you need to access the container terminal, you can use:
docker compose exec web bashIn production, the following commands are scheduled via cron:
update_table_status: Runs Hourly at :00batch_notification: Runs Hourly at :30send_queued_notifications: Runs Every 10 minutescleanup_old_notifications: Runs Daily at 3:00 AM UTC
Run with python manage.py [command-name]
-
setup_ses_template- Used to update AWS SES templates for new table notifications.
- Usage: Run this ONLY if the base template or the
email_notification_new_tabletemplate has been modified.
-
populate_db- Usage: Run this only locally to generate test data in your local database.
-
manage_notifications- Used to manage and clean up notifications.
- Functionality: Can set notifications as read, sent, or delete them.