API service for managing flight bookings, built using Django REST Framework.
-
Clone the repository:
git clone https://github.com/BitRxp/airport-api-service.git
-
Navigate to the project directory:
cd airport_api_service
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Configure environment variables:
SECRET_KEY=<your-secret-key> DEBUG=<True/False> ALLOWED_HOSTS=<comma-separated-allowed-hosts> POSTGRES_PASSWORD=<your-postgres-password> POSTGRES_USER=<your-postgres-username> POSTGRES_DB=<your-database-name> POSTGRES_HOST=<your-database-host> POSTGRES_PORT=<your-database-port> PGDATA=<path-to-postgresql-data>
-
Apply the database migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
-
Build the Docker images:
docker-compose build
-
Start the Docker containers:
docker-compose up
-
Locally: Create a superuser by running:
python manage.py createsuperuser
-
From within a Docker container:
- Access the container shell:
docker exec -it <container_name> bash
- Create a superuser:
python manage.py createsuperuser
- Access the container shell:
- To register, use the API endpoint at
/api/user/register
. - Obtain a JWT authentication token at
/api/user/token
.
- JWT-based authentication
- Request throttling to prevent abuse
- Interactive API documentation at
/api/schema/swagger-ui
- Manage bookings, tickets, and associated data
- Admin-only endpoints for creating airports, routes, crew members, airplanes, flight types, and schedules
- Advanced filtering for routes and flights