This is the repo for the Warwick Tabletop Games and Roleplaying Society website! You can find a live copy of it here.
There is also a document explaining the running of the website, How To Website Really Good, which you can use to find out how the website is used in practice and what areas for improvement it currently has.
To run a local copy of the website for development, you'll need to install various bits, add the required configuration variables, and then create some bits required by Django. We'll go through each of those now.
This step is fairly simple, particularly if you're familiar with Python projects.
- The website is currently tested on Python 3.6. As such, you'll need to have a Python environment running that version. It is recommended that you create a virtual environment for the app.
- Install required Python packages using
pip install -r requirements.txt
.
The website utilises a variety of environment variables. These can be set in one of two ways:
- However you traditionally set environment variables on your system, e.g. via the
export
command in Bash. This is generally not recommended - it works, but the second method is preferred. - Create a
keys.py
and alocal_config.py
file in the same directory assettings.py
.keys.py
should contain one definition,def secret()
, which just returns a secret key (see the next section).local_config.py
can then be filled with definitions for all other variables - just write them as you'd write a usual assignment in Python (e.g.DEBUG=False
). These two files are loaded when Django is started, so the environment will be updated accordingly.
The following environment variables are mandatory:
SECRET_KEY
: Site's own secret key, for encryption. See Django's documentation of theSECRET_KEY
setting.
The following fields are optional:
DEBUG
: Determines whether to run the server in debug mode. See Django's documentation of theDEBUG
setting. DO NOT RUN A PRODUCTION SERVER WITH THIS ENABLED.EMAIL_HOST
: Hostname of email API server. Email settings are required in order to properly send pasword reset emails and notifications.EMAIL_HOST_USER
: Username to use to login to mail API.EMAIL_HOST_PASSWORD
: Ditto, for password.FROM_EMAIL
: Address to send emails from (eg "noreply@somesite.xyz").HOST
: Hostname to add to allowed hosts. See Django's documentation of theALLOWED_HOSTS
setting.
Again, if you're using local_config.py
, you just write these as assignments like EMAIL_HOST=...
.
The website needs a few more steps to set up the database and your superuser account for the first time. The following bullet points detail the steps you need to take.
- First, ensure migrations are present:
python manage.py makemigrations
- You may need to list all the apps, like so
python manage.py makemigrations assets exec forum gallery inventory messaging minutes navbar newsletters notifications pages redirect rpgs templatetags timetable users website_settings
- You may need to list all the apps, like so
- Run database migrations:
python manage.py migrate
- Create a super user:
python manage.py createsuperuser
- Run the server using
python manage.py runserver
- this is how you test the website throughout development. - The server will be running on
localhost:8000
. - You should create a
Member
for your super user, since this is currently not automatically done. - Go to the admin site at
/admin
, log in, and add a Member object withequiv_user
set to your superuser. IF you do not do this then your superuser will cause errors when viewing the site. - Now you can optionally load some demo data into the database using the command
python manage.py loaddata ./tgrsite/fixture.json
. Currently, a fixture exists, but it contains data from the live website so we do not publish it to be safe. This is available on request. - Finally, the homepage is a redirect to one of the static pages, which won't be present in the database if you've not loaded data. Create a new Page called index by going to the Admin Panel, clicking on Pages and then clicking "add new" in the top right. Name it index
Contributions welcome, in the form of issue submissions, pull requests, and comments.
If you want to add a feature, fork and branch the repo, and create a pull request into main
.
If you do contribute, please format your code in pep8 style. A tool like autopep8
should be available for your IDE, which will do this for you.
If you have a great idea for a feature, please create an issue for it! Feel free to discuss issues as well within comment threads, or on the Tabletop Society Discord.