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)
The database will be PostgreSQL-based database hosted on fly.io.
- users
- games
- cups
- courses
- times
- 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
Most of the fancier db things are todo. This is sort of the MVP (minimun viable product).
The site is being deployed at https://tsoha-flask.fly.dev/
Works as the main page, can navigate to other sites.
GET games
List of games.
GET cups
List of cups
GET courses
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.
GET create/time
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.
If you get an error sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres
,
change your url from postgres://
to postgresql://
.
If you want to run this locally, you need
- Virtual environment
- Proper .env file
- Docker and docker-compose installed (optional)
- Venv (virtual environment) can be achieved through running
python -m venv .venv
in thetimetrials
directory. This will create the venv file totimetrials/.venv
(a hidden file). .env
needs to containPOSTGRES_URL
andSECRET_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