-
Clone the repository:
git clone [repository-url]
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create .env file:
- Copy
.env.exampleto.env - Fill in your environment variables
- Copy
-
Run migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
The API will be available at http://localhost:8000/api/
Main endpoints:
api/recipes/- List all recipesapi/recipes/<id>/- Get specific recipeapi/recipes/create/- Create new recipeapi/recipes/<id>/edit/- Edit/Delete recipeapi/recipes/<recipe_id>/reviews/- Get recipe reviewsapi/recipes/<recipe_id>/create-review/- Create review
api/auth/- Base authentication endpoints including:api/auth/login/- User loginapi/auth/logout/- User logoutapi/auth/password/reset/- Request password resetapi/auth/password/reset/confirm/<uidb64>/<token>/- Confirm password reset
api/auth/registration/- User registration endpoints
api/token/- Obtain JWT token pairapi/token/refresh/- Refresh JWT token
swagger/- Swagger UI documentationredoc/- ReDoc documentationswagger.json- Raw API schema
admin/- Django admin interface- Recipes endpoints (detailed in swagger documentation)
-
Registration:
POST /api/auth/registration/ { "username": "user", "password1": "your_password", "password2": "your_password" }
-
Login and Get Token:
POST /api/token/ { "username": "user", "password": "your_password" }
Response will include
accessandrefreshtokens -
Using the API: Add the access token to all protected requests:
Authorization: Bearer <your_access_token> -
Refresh Token: When access token expires (15 minutes), get a new one:
POST /api/token/refresh/ { "refresh": "<your_refresh_token>" }
-
Password Reset:
- Request reset:
POST /api/auth/password/reset/ - Confirm reset:
POST /api/auth/password/reset/confirm/<uidb64>/<token>/
- Request reset:
- API Base URL:
http://localhost:8000/ - Admin Interface:
http://localhost:8000/admin/ - Swagger UI:
http://localhost:8000/swagger/ - ReDoc:
http://localhost:8000/redoc/
This API uses JWT authentication:
- Token URL:
api/auth/jwt/create/ - Refresh URL:
api/auth/jwt/refresh/ - Token lifetime: 15 minutes
- Refresh token lifetime: 7 days
- Swagger UI:
http://localhost:8000/swagger/ - ReDoc:
http://localhost:8000/redoc/
CORS is currently enabled for all origins. Frontend can connect from any domain in development.