This document provides instructions on how to set up and use the Django application for managing pilot logs. It covers the creation of a virtual environment, installation of required packages, running the Django server, and details on how to use the provided APIs.
To create a virtual environment, follow these steps:
- Open your terminal or command prompt.
- Navigate to your project directory using the
cd
command. - Run the following command to create a virtual environment named
venv
:
python -m venv venv
- Activate the virtual environment:
source venv/bin/activate
- Installing Packages from requirements.txt
pip install -r requirements.txt
- Running the Server: To run the Django server, execute the following command:
python manage.py runserver
This command starts the development server on http://127.0.0.1:8000/. You can access the application through this URL in your web browser.
The application provides three main APIs for managing pilot logs:
- Create and List Pilot Logs
- Endpoint:
/api/v1/pilotlogs/
- Method: GET for listing, POST for creating
- Data Parameters for POST:
file
: a valid json file
- Success Response:
- Code: 200 OK for GET, 201 Created for POST
- Pilot Log Details
- Endpoint:
/api/v1/pilotlogs/:id
- Method: GET
- URL Parameters:
id
: a valid pilot log ID- Success Response:
- Code: 200 OK
- Download Pilot Log as CSV
- Endpoint:
/api/v1/pilotlogs/:id/download
- Method: GET
- URL Parameters:
id
: a valid pilot log ID- Success Response:
- Code: 200 OK