- Introduction
- Prerequisites
- deployed Application
- Setup and Running the Project Locally
- API Endpoints
- Note on API Testing
- Models Overview
- Project Structure
- Done by
This project is a Django application containerized with Docker, designed to manage recipes,users, ingredients, and tags.
Make sure you have the following installed and running on your local machine:
- Docs URL
- Admin page URL and enter your super user email and password
git clone https://github.com/yourusername/your-repo-name.git
cd your-repo-name
copy sample.env :cp sample.env .env
docker-compose up --build
http://127.0.0.1:8000/api/docs
If you need to make migrations and apply database migrations, run the following commands:
docker-compose run --rm app sh -c "python manage.py makemigrations"
docker-compose run --rm app sh -c "python manage.py migrate"
To create a superuser for accessing the Django admin, run:
docker-compose run --rm app sh -c "python manage.py createsuperuser"'
after creating your user by enterign email and password you can go to http://127.0.0.1:8000/admin
to test admin page
To stop the running containers, use:
docker-compose down
The application includes endpoints for managing recipes, ingredients, and tags. There is public and private endpoints.For testing endpoints and know how to use each one you can go to the swagger documentation below
- locally by hitting:
http://127.0.0.1:8000/api/docs/
- or by go to the aws deployed link :
http://ec2-51-20-8-74.eu-north-1.compute.amazonaws.com/api/docs/
Almost all of the API endpoints are private, meaning they require the user to be authenticated. To successfully test the endpoints without getting an unauthorized 401 error when accessing the Swagger link, please follow these steps:
1- Locate the User model endpoints.
2- Go to the POST: /api/user/create/
endpoint and register a user.
3- Go to the POST: /api/user/token
endpoint and log in with your email and password to obtain a token.
Click on the "Authorize" button at the top of the page, and in the last option (token), enter Token "your token from the previous step".
For a quick overview, here are the main models:
Recipe: Contains fields for title, description, user, ingredients,time_minutes,price,link,image and tags. User: Contains fields for email,name,is_active,is_staff Ingredient: Contains fields for name and user who added that ingredient. Tag: Contains a field for the tag name and user who added it .