Skip to content

iritmaximus/timetrials

Repository files navigation

Tsoha-project

Forum

The subject of the project is a forum. Just a simple forum that one can log into and make/view posts and commend etc. Sike, we are doing a database for time trial-times in video games. (Mostly Nintendo racing games = Mario Kart) The main functionality is that one can add times to specific games and/or tracks and get a rank based on those times (see https://www.mariokart64.com/mkdd/standardc.php)

Database

The database will be PostgreSQL-based database hosted on fly.io.

Tables (at least)

  • users
  • games
  • cups
  • courses
  • times

Fancier db things

  • user can log in and create new times.
  • can see times by game, cup and course.
  • the site tells how many times there are for each category.
  • can click on individual courses, cups or games to see all the times in the selected category

Välipalautus 3

Most of the fancier db things are todo. This is sort of the MVP (minimun viable product).

Deployment

The site is being deployed at https://tsoha-flask.fly.dev/

Routes

Works as the main page, can navigate to other sites.

GET games

List of games.

GET cups

List of cups

List of all courses.

GET login

Login page to the site. You will be redirected here, if you try to access other pages without a session (login in).

GET times

List of all times submitted by the players. There is also a button to add new times.

A page where you can submit new times, you have to be logged in for the submission to go through.

You will be redirected to some of these from clicking any of the corresponding fields in the times.

Note

If you get an error sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres, change your url from postgres:// to postgresql://.

Local dev

Requirements

If you want to run this locally, you need

  • Virtual environment
  • Proper .env file
  • Docker and docker-compose installed (optional)

Setting up

  • Venv (virtual environment) can be achieved through running python -m venv .venv in the timetrials directory. This will create the venv file to timetrials/.venv (a hidden file).
  • .env needs to contain POSTGRES_URL and SECRET_KEY
  • The POSTGRES_URL needs to be the full url to your postgres database, containing user, password and database
  • SECRET_KEY is some random string that you need to create. One simple way is to launch the python interactive prompt with
python

and then run the commands

>>> import secrets
>>> secrets.token_hex(16)

and copy the result to the SECRET_KEY variable.

After that you can either build the app by running

docker-compose up -d

If you don't have or don't want to use docker, you can activate the venv by calling

source .venv/bin/activate

(google the proper way to do it if you are on Windows). Then install the requirements with pip

pip install -r requirements.txt

and then you can just run the command

python run.py

About

A tsoha-project made with Python/Flask, Docker and PostgreSQL. Deployed with GH Actions and Fly.io

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published