This is the main code repository for racetime.gg, a website for organising races online, with a focus on video games and speedruns.
If you're ready to start hacking the code, read on.
The recommended way to run a development environment is using Docker. You can download install Docker Desktop for your machine, which will allow you to spin up a full copy of the site in isolation, with all its dependencies fulfilled.
Make sure that Docker has the ability to share the repository directory with containers. On Docker Desktop, look for "Shared Drives" or "File Sharing" under settings to configure this.
- Clone this repository.
- Copy
project/settings/local.py.example
toproject/settings/local.py
. - Edit the local.py file above and set your dev.twitch.tv client credentials.
- Run
npm install
to grab JS dependencies (you'll need NodeJS installed). - Start the environment with
docker-compose up --build -d
. - Run
docker-compose exec racetime.web python manage.py migrate
to set up a database with migrations.- Note: you may need to wait a minute or two for the environment to be ready.
- (Optional) Run
docker-compose exec racetime.web python manage.py createsuperuser
to create a superuser account that you can log in as. - (Optional) Run
docker-compose exec racetime.web python manage.py fixtures
to set up some basic data for testing purproses (e.g. users and race categories).- Users created by the fixtures command will have password
pass
.
- Users created by the fixtures command will have password
The site will now be available to browse on http://localhost:8000, so take a look around!
You can watch the logs of all containers by running docker-compose logs -f
,
or by running docker-compose up
without the -d
(detatch) flag. Beware that
if you do the latter then Ctrl+C will kill off the containers and stop your
environment, so it's probably better to use something like
docker-compose up -d && docker-compose logs -f
.
The docker-compose.yml
file attaches the web container to port 8000 by
default. If you need to override this, create a docker-compose.override.yml
file with the following contents:
version: '3.6'
services:
racetime.web:
ports:
- "<LOCAL>:8000"
Replace <LOCAL>
with whatever port number you'd like.
If you'd like to use a fancy client app to browse the database, you can set up
a docker-compose.override.yml
file to expose the database port to your local
machine:
version: '3.6'
services:
racetime.db:
ports:
- "<LOCAL>:3306"
Replace <LOCAL>
with whatever port number you'd like. The DB username,
password and database name are all racetime
by default.
You should not use an IP address to connect to the website in your browser, as
this is not compatible with the Twitch API. Always use
http://localhost:8000 to access the server instead of
http://127.0.0.1:8000
.
If you're developing on Windows, make sure to check out this repository with
Linux-style line endings (LF not CRLF), in particular you need to make sure the
Bash scripts in the .docker
directory have the correct line endings or they
will fail to execute.
The Wiki pages have some information that may prove useful to you. We also have a Discord server where you can discuss the site and ongoing developments, make suggestions and get involved: join the Discord server here.
All contributions are welcome to help improve the site. Whether you're good at coding, or designing, or simply want to spread the word, you can help us make racing and speedruns better for everyone. Join up to the Discord server if you want to get more involved!