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.
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)
There are two options to run the Flight Search API: using UV or using Docker. Follow the instructions for your preferred method.
pip install uv
uv venv
source .venv/bin/activate
uv pip compile pyproject.toml -o requirements.txt
uv pip compile pyproject.toml --extra testing -o requirements-dev.txt
uv pip install -r requirements.txt
uv pip install -r requirements-dev.txt
python manage.py migrate
docker compose build
docker compose up -d
docker compose exec web bash
docker compose exec web python manage.py migrate
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.
To run the test suite, use the following command:
pytest