This repo contains code for the backend written in Django and PostgreSQL.
- Python 3.9.16
- PostgreSQL 15.4
Python 3.12.1 with Django 5.0 was also tested in a dev/test environment but not in production.
- Create a virtual environment (e.g.
venv
). Activate it and upgradepip
withpip install --upgrade pip
. - Install all required dependencies with
pip install -r requirements.txt
. Alternatively, use the script for Linux or for Windows which will install the latest available packages. - Add every required environmental variable, that is:
- from the settings file:
- from the generators module; they indicate paths to .ttf files with specified font types:
REGULAR_FONT
BOLD_FONT
ITALIC_FONT
- Create a PostgreSQL database.
- Run
python manage.py migrate
to create tables and relations in the database.
- Set the
DEBUG
variable in the settings file toTrue
. - In the settings file add appropriate IP addresses to
CORS_ALLOWED_ORIGINS
(more details here). - Run a dev/test server:
python manage.py runserver
- Pick an HTTP server (e.g. httpd with mod_wsgi). It will be used to serve both the app and the media (Django doesn't do that by itself).
- In the settings file add appropriate IP addresses to
CORS_ALLOWED_ORIGINS
(more details here). - Go through the deployment checklist.
- Deploy the app to the web server.
Run python runtests.py
.
- Create an admin user:
python manage.py createsuperuser
- Clean duplicate history records:
python manage.py clean_duplicate_history --auto
- Make a migration:
python manage.py makemigrations reagents
- Show available URLs:
python manage.py show_urls