A website to manage robotics tournaments, built using Django. The production website is accessible at https://vex.thearchons.xyz/.
- Python 3
- Just (production only)
- Clone the repository
- Cd into the repository
- Create a venv with
python3 -m venv venv - Activate the venv with
source ./venv/bin/activate - Run
pip install -r requirements.txtto install the packages - Add a
.envfile to the project root (wheremanage.pyis)
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": ""
}debugis for use when debugging. This should be set to false when running in production for security reasons.keyis a secret key used by django. Generate one here.allowed_hostsare the allowed hosts/domains. For development servers, the default is127.0.0.1static_rootis where your static files will be collected when runningpython manage.py collectstatic. This can be left blank for development.
- Run
python manage.py makemigrationsand thenpython manage.py migrateto setup the database. - Create a superuser with
python manage.py createsuperuser. - 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.
- Collect static files with
python manage.py collectstatic. - Because
python manage.py runserveris for development servers and is insecure, you should run the server with gunicorn instead. Rungunicorn vex_tournament.wsgi:application --bind 0.0.0.0:8000to start the server. - 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. - In order to enable the CSS, set the
/staticlocation 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;
}
}- The production server uses the
justfileto start the server. Configure the justfile and runjustin the project directory to easily start the server.
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.