The website is built using Django, and uses redis for caching and celery as a task queue.
Users can find a user documentation here.
The main repository lives on the ETH Gitlab and is mirrored to Github.
The repository contains the needed configurations to deploy to SIP.
- Make sure Docker is installed.
- Clone this repo:
git clone <repo-url>
- Create a python environment using python
>= 3.9
. You can for example set it up with a venv.python3 -m venv venv
source venv/bin/activate
- Initialize the project:
./scripts/initialize_project.sh
(this will install the requirements and start the Docker containers) - Run the project:
python manage.py runserver
(from within your venv!) - Find the website at localhost:8000
- Import a database dump (see below)
When you are done developing, stop the containers again: docker compose down
.
Useful resources:
All configuration lives in an environment file: .env
.
The following elaborate scheme of scripts is used to generate it.
The file variables.yml
is the single source of truth by defining all environment
variables needed for this project
to run.
The file is checked into the git repository.
Do not modify variables.yml
unless you want to define new env variables or remove
outdated ones.
The file overrides.yml
contains custom values for your setup.
A basic version will be generated when initializing the project.
This file is ignored by git.
Do not add it to the repository.
The file is machine specific and could potentially contain secrets.
Both need to be of the following form:
# General form for an entry
<NAME_OF_VARIABLE>: <value>
# Example
COMPOSE_FILE: docker-compose.yml
TQ_DEBUG: true
Run ./scripts/generate_env.py [--sip] [--overrides FILE]
to generate the environment.
- Without arguments it will create a
.env
file for Docker Compose and Django to use. --sip
will read the variables provided by SIP and create a.env
file- To use a different overrides file specify
--overrides
Get a database dump from the IT board member of Tanzquotient or use one of the dumps on the Google Drive in the IT folder.
Restore the database:
# Wipe the old database
docker exec -i tq-postgres psql -U root -d postgres -c "DROP DATABASE tq_prod_website_tq_website;"
docker exec -i tq-postgres psql -U root -d postgres -c "CREATE DATABASE tq_prod_website_tq_website;"
# Restore the dump
docker exec -i tq-postgres pg_restore --no-privileges --no-owner --format=c --schema='public' --create --dbname tq_prod_website_tq_website < dbfilename.sql
# Run the migrations (just in case, e.g. if the SQL dump is old)
python manage.py migrate
Maybe required if the database name in the prod dump differs from your local database name: Rename the database to the local name:
DROP DATABASE tq_website;
ALTER DATABASE tq_prod_website_tq_website RENAME TO tq_website;
- Not-quite-up-to-date: ReadTheDocs
- IT and developer documentation: Tanzquotient Wiki (requires you to be added to the TQ team by the IT board member)
- General VSETH docs about SIP: https://dev.vseth.ethz.ch/