This project is a fully functional REST API built with Python, Django, and Django REST Framework. It includes features for user authentication, recipe management, and image uploading, all containerized using Docker.
- User Authentication: Register and login users using Token Authentication.
- Recipe Management: Create, view, update, and delete recipes.
- Ingredients & Tags: Manage ingredients and tags for recipes.
- Image Upload: Upload and manage images for recipes.
- Filtering: (Implied capability pending implementation)
- Documentation: Auto-generated interactive API documentation using Swagger/OpenAPI.
- Python (3.9+)
- Django (Web Framework)
- Django REST Framework (API Toolkit)
- PostgreSQL (Database)
- Docker & Docker Compose (Containerization)
- Drf-spectacular (API Schema generation)
- Flake8 (Linting)
This project uses Docker to ensure a consistent development environment.
- Docker installed on your machine.
- Docker Compose installed.
-
Clone the repository:
git clone <your-repo-url> cd <your-project-directory>
-
Build and Run:
docker-compose up
This command will build the Docker image and start the Django development server along with a PostgreSQL database.
The API will be available at http://127.0.0.1:8000/.
-
Run Migrations (if not done automatically):
docker-compose run --rm app sh -c "python manage.py migrate" -
Create a Superuser:
docker-compose run --rm app sh -c "python manage.py createsuperuser"
To ensure code quality, you can run the test suite and linter using Docker.
-
Run Tests:
docker-compose run --rm app sh -c "python manage.py test" -
Run Linting (Flake8):
docker-compose run --rm app sh -c "flake8"
The API comes with auto-generated documentation via Swagger.
- Swagger UI: Visit http://127.0.0.1:8000/api/docs/ to explore and test the API endpoints interactively.
- Schema: The raw OpenAPI schema is available at http://127.0.0.1:8000/api/schema/.
.
├── app/
│ ├── app/ # Project configuration
│ ├── core/ # Core models and shared components
│ ├── recipe/ # Recipe API logic (views, serializers, tests)
│ ├── user/ # User API logic
│ └── manage.py
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker services config
├── requirements.txt # Production dependencies
└── requirements.dev.txt # Development dependencies