Skip to content

Maximus2012/foodgram-st

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍲 Foodgram – Recipe Sharing API

A backend service for managing and sharing recipes, subscribing to authors, adding favorites, and generating shopping lists.


Tech Stack

Category Technologies
Backend Python 3.9, Django 3.2, Django REST Framework
Authentication Djoser, Simple JWT
Database PostgreSQL
Containerization Docker, Docker Compose
CI/CD GitHub Actions, Nginx

Getting Started

1. Clone the Repository

git clone https://github.com/Maximus2012/foodgram-st.git
cd foodgram-st/infra

2. Setup Environment Variables

Create a .env file at:

foodgram-st/infra/.env

Example content:

DEBUG=False
SECRET_KEY=your-django-secret-key

DB_NAME=foodgram
DB_USER=postgres
DB_PASSWORD=postgres
DB_HOST=db
DB_PORT=5432
ALLOWED_HOSTS=127.0.0.1,localhost,example.com

3. Run with Docker

docker compose build
docker compose up

After startup, the project will be available at:
👉 http://localhost/recipes

Django Admin Panel Accessible at:
👉 http://localhost/admin/

API Accessible at:
👉 http://localhost/api/docs/


4. Run API Locally (Without Docker)

  1. Go to the backend folder:
cd ../backend
  1. Create a virtual environment:
python -m venv venv
  1. Activate it:
  • Windows:
venv\Scripts\activate
  • macOS/Linux:
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Apply migrations:
python manage.py migrate
  1. Load initial ingredient data:
python manage.py import_data
  1. Run the server:
python manage.py runserver

After startup, the project will be available at:
👉 http://127.0.0.1:8000


Optional:

You can use fixtures to load users and recipes:

python manage.py loaddata users_and_recipes.json

Project Structure

foodgram-st/
├── backend/                  # Django project
├── frontend/                 # Optional React app
├── infra/
│   ├── docker-compose.yml    # Docker Compose config
│   └── nginx.conf            # Nginx config
├── data/                     # Initial ingredients
└── docs/                     # API documentation

Author

Max Kochetkov
GitHub Profile

About

foodgram-st

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors