This repository contains the source code for the homepage of Fachschaftsrat Maschinenbau (FaRaFMB). FaRaFMB is the student representative for the faculty of mechanical engineering at the Otto von Guericke University Magdeburg.
The website is build with Django and uses Bulma for styling.
Setup a local environment with virtualenv. Activate it and install all dependencies.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python -m pip install coverageCreate a new config file for env vars. Update values as required. Generate a new secret key and place it in your config.
cp .env.example .env
python3 -c "from django.core.management import utils; print(utils.get_random_secret_key())"Migrate the database and create an admin account.
python manage.py migrate
python manage.py createsuperuserInstall volta as node tool manager. Afterwards install node to manage packages.
curl https://get.volta.sh | bash
volta install node
volta install sassInstall node dependencies and build stylesheets.
npm install
npm run buildFinally start your development server.
python manage.py runserverDo not forget to write A LOT of tests. Always increase test coverage.
coverage run manage.py test
coverage report --skip-coveredImages are build using buildah.
./build.shThe script builds the container and publishes it to GitHub container registry. Check the script for required env vars.
Images can be run as containers with podman. After starting a container one needs to collect all statics and migrate the database.
podman run \
--name farafmb \
--restart always \
--detach \
--userns keep-id \
--volume ./farafmb:/srv/farafmb \
--publish 127.0.0.1:8000:8000 \
--env-file ./.env \
ghcr.io/timptner/farafmb:latest
podman exec farafmb .venv/bin/python3 manage.py collectstatic --no-input
podman exec farafmb .venv/bin/python3 manage.py migrate --no-input --checkDjango connects to postgres via unix domain socket. Therefor it can be required
to update pg_hba.conf and allow password authentication, espiacially when
connecting from inside containers because the user namespace does not match and
peer will therefor not work!
// TODO
- Use nginx as proxy
- Use postgres as database
- Share volumes for persistent storage and serve static files via nginx
- Add https with certbot
- Add backups with borg (include pg_dump and volumes)
- Add logs and setup logrotation
At the moment only german localization is supported on this project. Actually german is used as the primary language and english as the secondary but in the source code it is vice versa because of the intended implementation of Django.
To generate the files containing all string to localize run:
django-admin makemessages --locale "de" --ignore "venv/*"And to compile the localized strings into binary data, which is used by gnugettext run:
django-admin compilemessages --locale "de" --ignore "venv/*"