Skip to content

WarwickTabletop/tgrsite

Repository files navigation

tgrsite

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.

How do I run a development copy of the website?

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.

1. Installing things

This step is fairly simple, particularly if you're familiar with Python projects.

  1. 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.
  2. Install required Python packages using pip install -r requirements.txt.

2. Environment configuration

The website utilises a variety of environment variables. These can be set in one of two ways:

  1. 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.
  2. Create a keys.py and a local_config.py file in the same directory as settings.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.

Environment variables

The following environment variables are mandatory:

The following fields are optional:

Again, if you're using local_config.py, you just write these as assignments like EMAIL_HOST=....

3. Running the website

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
  • 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 with equiv_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

Contributing

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.