Skip to content

vex-tournament/vex_tournament

Repository files navigation

vex_tournament

A website to manage robotics tournaments, built using Django. The production website is accessible at https://vex.thearchons.xyz/.

Getting Started

Requirements

  • Python 3
  • Just (production only)

Installation

  1. Clone the repository
  2. Cd into the repository
  3. Create a venv with python3 -m venv venv
  4. Activate the venv with source ./venv/bin/activate
  5. Run pip install -r requirements.txt to install the packages
  6. Add a .env file to the project root (where manage.py is)

The .env stores settings that are used by vex_tournament/settings.py. Here is an example:

{
    "debug": true,
    "key": "YOUR-SECRET-KEY-HERE",
    "allowed_hosts": ["127.0.0.1"],
    "static_root": ""
}
  • debug is for use when debugging. This should be set to false when running in production for security reasons.
  • key is a secret key used by django. Generate one here.
  • allowed_hosts are the allowed hosts/domains. For development servers, the default is 127.0.0.1
  • static_root is where your static files will be collected when running python manage.py collectstatic. This can be left blank for development.
  1. Run python manage.py makemigrations and then python manage.py migrate to setup the database.
  2. Create a superuser with python manage.py createsuperuser.
  3. Run the server with python manage.py runserver

If you only need it for development. The site should now be accessible at 127.0.0.1. However, more configuration is required to run a secure production server.

  1. Collect static files with python manage.py collectstatic.
  2. Because python manage.py runserver is for development servers and is insecure, you should run the server with gunicorn instead. Run gunicorn vex_tournament.wsgi:application --bind 0.0.0.0:8000 to start the server.
  3. The server should now be accessible at 0.0.0.0:8000, but will not include CSS for the admin site. In order to make it accessible from the internet, use a reverse proxy such as nginx.
  4. In order to enable the CSS, set the /static location to your static root location. Here is an example nginx configuration that is similar to the one used by the production server.
access_log                  /var/log/nginx/vex.access.log;
error_log                   /var/log/nginx/vex.error.log;

server {
  server_name               vex.thearchons.xyz;
  listen                    80;
  return                    307 https://$host$request_uri;
}

server {
  server_name               vex.thearchons.xyz;
  listen 443 ssl;
  #ssl on;
  ssl_certificate /var/www/cert.pem;
  ssl_certificate_key /var/www/key.pem;

  location / {
      proxy_pass              http://127.0.1.1:8000;
      proxy_set_header        Host $host;
  }

  location /static {
       autoindex on;
       alias /home/archons/vex_tournament/static_root;
  }
}
  1. The production server uses the justfile to start the server. Configure the justfile and run just in the project directory to easily start the server.

Usage

The main site will not be useful until the tournament is configured. Configure the server at YOUR-URL/admin. To reset the playoffs, delete every object in Playoff Matches and Brackets at YOUR-URL/admin.

About

Robotics tournament manager

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •