World of Warcraft guild manager powered by Django.
Find a file
2022-08-13 16:29:49 +02:00
drakul DB_DB_NAME -> DB_NAME 2022-08-13 16:29:49 +02:00
screenshots Add screenshots. 2020-07-06 14:55:43 +02:00
.gitignore Initial 2019-10-25 02:49:09 +02:00
activate.sh Initial 2019-10-25 02:49:09 +02:00
LICENSE Initial 2019-10-25 02:49:09 +02:00
manage.py Initial 2019-10-25 02:49:09 +02:00
migrate.py Introduce optional raids. 2019-11-20 22:53:38 +01:00
README.md DB_DB_NAME -> DB_NAME 2022-08-13 16:29:49 +02:00
requirements.txt Django 4.1.0 2022-08-13 14:29:59 +02:00

Drakul

Drakul is an online system for organising and managing the raids and members of a World of Warcraft guild. Thanks for checking it out.

Setup

The following steps installs the application in /opt/drakul/ and configures nginx to reverse proxy it using uwsgi. While the instructions are focused on Debian 10 Buster, it might work on other distributions as well.

Start by installing the required packages:

apt install git python3 python3-venv nginx uwsgi uwsgi-plugin-python3

Create a system user for running the application:

adduser \
   --system \
   --shell /bin/bash \
   --group \
   --disabled-password \
   --home /opt/drakul \
   drakul

Clone the code:

su - drakul
git clone https://git.caspervk.net/caspervk/drakul /opt/drakul

Setup virtual environment and install dependencies:

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
logout

Add the uwsgi configuration file, /etc/uwsgi/apps-available/drakul.ini:

[uwsgi]
workers = 2

chdir = /opt/drakul/
venv = /opt/drakul/venv
module = drakul.base.wsgi:application

socket = /run/uwsgi/app/drakul/socket
chown-socket = www-data
chmod-socket = 660
vacuum = true

daemonize = /var/log/uwsgi/app/drakul.log

uid = drakul
gid = drakul

plugins = python3

exec-pre-app = venv/bin/python manage.py migrate --no-input
exec-pre-app = venv/bin/python manage.py collectstatic --no-input

; Change these as needed
env = DJANGO_SETTINGS_MODULE=drakul.base.settings.production
env = SECRET_KEY=hunter2  ; the result of 'head -c 56 /dev/random | base64' is a good idea
env = ALLOWED_HOSTS=drakul.example.com

Enable the application in uwsgi:

ln -s /etc/uwsgi/apps-available/drakul.ini /etc/uwsgi/apps-enabled
service uwsgi restart

Add the following to your /etc/nginx/sites-available/drakul.example.com:

location / {
    include uwsgi_params;
    uwsgi_pass unix:/run/uwsgi/app/drakul/socket;
}

location /static/ {
    alias /opt/drakul/drakul/static/;
}

That's it! After restarting nginx everything should work. The default superuser username/password is admin/admin.

Environment variables

Defaults are bolded.

Django

  • DJANGO_SETTINGS_MODULE: drakul.base.settings.production.
  • SECRET_KEY: The result of running head -c 56 /dev/random | base64 is a good idea.
  • ALLOWED_HOSTS: A comma-separated list of the domain names Django is allowed to serve. Security measure to prevent HTTP Host header attacks. Only used and required in production.

Database (docs)

  • DB_ENGINE: django.db.backends.sqlite3.
  • DB_NAME: db.sqlite3.
  • DB_HOSTNAME: localhost.
  • DB_PORT: 5432.
  • DB_USERNAME: root.
  • DB_PASSWORD: root.

Development

# Configure environment
source activate.sh

# Create admin user
m createsuperuser

# Start the server
m runserver 8000