Skip to content

Django-based Flight Search API for retrieving flight routes and trip details. Features include origin/destination/date-based search, CSV data import, and flexible deployment options using UV or Docker.

Notifications You must be signed in to change notification settings

cdragos/incubeta

Repository files navigation

Flight Search API

This is a Django-based Flight Search API that allows users to search for flight routes based on origin, destination, and departure date. The API provides endpoints to retrieve flight information and trip details.

Table of Contents

Prerequisites

Before running the Flight Search API, make sure you have the following prerequisites installed:

  • Python 3.x
  • pip (Python package installer)
  • UV (if running with UV)
  • Docker (if running with Docker)

Installation

There are two options to run the Flight Search API: using UV or using Docker. Follow the instructions for your preferred method.

Option 1: Running with UV

Install UV:

pip install uv

Create a virtual environment:

uv venv
source .venv/bin/activate

Compile the project dependencies:

uv pip compile pyproject.toml -o requirements.txt
uv pip compile pyproject.toml --extra testing -o requirements-dev.txt

Install the project dependencies:

uv pip install -r requirements.txt
uv pip install -r requirements-dev.txt

Run database migrations:

python manage.py migrate

Option 2: Running with Docker

Build the Docker containers:

docker compose build

Start the Docker containers:

docker compose up -d

Access the web container:

docker compose exec web bash

Run database migrations:

docker compose exec web python manage.py migrate

Usage

Data Synchronization

To keep the flight route data up-to-date, we use a Django management command to import data from a CSV file. This can be executed as follows:

python manage.py sync_routes_data file_2.csv --batch-size=100

This command processes the CSV file in batches of 100 records at a time, ensuring efficient data handling and database performance.

Testing

To run the test suite, use the following command:

pytest

About

Django-based Flight Search API for retrieving flight routes and trip details. Features include origin/destination/date-based search, CSV data import, and flexible deployment options using UV or Docker.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages