Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

jmp/backmarker

Repository files navigation

Backmarker

A fun little project where I build a REST API for an F1 database backed by Django.

Some facts:

  • The backend is written in Python using the Django framework
  • The database is PostgreSQL
  • The data is from Ergast, under Creative Commons BY-NC-SA 3.0

Requirements

  • Python 3.9
  • PostgreSQL 13 or Docker

Installation

  1. Install Poetry
  2. Create a virtual environment and activate it
  3. Run poetry install to install all the dependencies
  4. Set up PostgreSQL with e.g. docker compose up db
  5. Run python manage.py migrate

Populating the database

To fill the database with some data, you can use the populate-db.sh script in the repository. It is a very basic script that downloads the latest Ergast MySQL database dump and attempts to convert it such that the rows can be inserted to the PostgreSQL database.

You may need to modify the credentials in the script if you are not using Docker Compose to run the database.

Running with Docker Compose

  1. Run docker compose build
  2. Run docker compose up

The API is now reachable at http://localhost:8000/api/. The OpenAPI specification can be downloaded at http://localhost:8000/api/schema/. The API documentation can be viewed at http://localhost:8000/api/schema/redoc/.

About

A small REST API for F1 data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published