A Django REST API service for managing airport operations, including flights, tickets, and user management.
- User Authentication with JWT
- Airport and Route Management
- Airplane and Flight Management
- Ticket Booking System
- Crew Management
- Admin Dashboard
- API Documentation with Swagger/ReDoc
- Docker Containerization
- Python 3.11
- Django 5.2.1
- Django REST Framework
- PostgreSQL
- Docker & Docker Compose
- JWT Authentication
- Swagger/ReDoc for API documentation
- Docker and Docker Compose installed
- Git
- Clone the repository:
git clone <repository-url>
cd Aeroport_API- Create
.envfile in the root directory with the following variables:
POSTGRES_DB=your_db_name
POSTGRES_USER=your_db_user
POSTGRES_PASSWORD=your_db_password
POSTGRES_HOST=db
POSTGRES_PORT=5432- Build and start the Docker containers:
docker-compose up --buildThe API will be available at http://localhost:8001
After starting the project, you can access the API documentation at:
- Swagger UI:
http://localhost:8001/api/doc/swagger/ - ReDoc:
http://localhost:8001/api/doc/redoc/
POST /api/user/register/- Register new userPOST /api/user/token/- Obtain JWT tokenPOST /api/user/token/refresh/- Refresh JWT tokenGET /api/user/me/- Get user profilePUT/PATCH /api/user/me/- Update user profile
GET /api/airport/airports/- List all airportsGET /api/airport/flights/- List all flightsGET /api/airport/routes/- List all routesGET /api/airport/tickets/- List all ticketsPOST /api/airport/orders/- Create new order
The API uses JWT (JSON Web Token) authentication. To access protected endpoints:
- Obtain token:
curl -X POST http://localhost:8001/api/user/token/ -d "email=user@example.com&password=password"- Use the token in requests:
curl -H "Authorization: Bearer <your-token>" http://localhost:8001/api/user/me/To run the test suite:
# Run all tests
docker-compose run --rm airport python manage.py test
# Run specific app tests
docker-compose run --rm airport python manage.py test user.tests
docker-compose run --rm airport python manage.py test airport.tests- Code Style
- The project uses flake8 for code style checking
- Run flake8:
docker-compose run --rm airport flake8- Making Migrations
docker-compose run --rm airport python manage.py makemigrations
docker-compose run --rm airport python manage.py migrate- Creating Superuser
docker-compose run --rm airport python manage.py createsuperuserAeroport_API/
├── airport/ # Airport app
│ ├── models.py # Database models
│ ├── views.py # API views
│ ├── serializers.py # Model serializers
│ └── tests.py # Tests
├── user/ # User management app
│ ├── models.py # Custom user model
│ ├── views.py # User views
│ └── tests.py # User tests
├── airport_api/ # Project settings
├── docker-compose.yml # Docker compose config
├── Dockerfile # Docker config
└── requirements.txt # Python dependencies
The API implements different permission levels:
- Anonymous users can only view public information
- Authenticated users can book tickets and manage their profiles
- Admin users have full access to all endpoints
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request