This project provides an API method to create a Google Drive document with a specified name and content. The project is implemented using Python, Django, and Django REST Framework (DRF) and is deployed using Docker Compose.
Before running this project, you need to set up a Google account and authorize the application to access Google Drive. Follow these steps:
- Create a Google account if you don't already have one.
- Go to the Google Cloud Console (https://console.cloud.google.com/).
- Create a new project.
- Enable the Google Drive API for your project.
- Create OAuth 2.0 credentials for your project.
- Download the credentials JSON file and save it in the
google_secretsdirectory ascredentials.json. - Run the application once to generate the token file and complete the OAuth 2.0 flow.
- Python
- Django
- Django REST Framework (DRF)
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/Srmrlt/NV_Challenge_Django.git cd NV_Challenge_Django -
Place the
credentials.jsonfile in thegoogle_secretsdirectory. -
Copy the example environment file and adjust the settings as needed:
cp .env.example .env
-
Build and run the application using Docker Compose:
docker-compose up --build -d
- URL:
/api/create-document/ - Method:
POST - Parameters:
data: The content of the file (string).name: The name of the file (string).
- Response: JSON object with the status of the request.
curl -Method Post -Uri http://localhost:80/api/create-document/ `
-ContentType "application/json" `
-Body '{
"data": "This is the content of the file.",
"name": "my-file.txt"
}'