Skip to content

NotMainCode/foodgram-project-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Foodgram

yamdb workflow

Description

Users can publish recipes, subscribe to publications of other users, add favorite recipes to "Favorites" and "Shopping List", as well as download a summary list of products (txt file) needed to cook one or more selected dishes.

Unauthorized users can:

  • Create an account
  • View recipes on homepage
  • View individual recipe pages
  • Filter recipes by tags

Authorized users can additionally:

  • Log in with their username and password
  • Log out
  • Change your own password
  • Create/edit/delete your own recipes
  • View user pages
  • Work with a personal favorites list: add recipes to it and delete them, view your favorites recipes page
  • Work with a personal shopping list: add/remove any recipes, upload a file with the number of necessary ingredients for recipes from the shopping list
  • Subscribe to recipe authors' publications and cancel your subscription, view your subscriptions page

In the standard Django admin panel, the administrator can additionally:

  • Change the password of any user
  • Create/block/delete user accounts
  • Edit/delete any recipes
  • Add/remove/edit ingredients
  • Add/remove/edit tags

The project is temporarily available at the links:

Foodgram

Foodgram Admin Site

Foodgram API documentation

Technology

Python 3.7

Django 2.2.28

Django REST framework 3.12.4

Djoser 2.1.0

Docker 23.0.0

Docker Compose 2.15.1

PostgreSQL 13.0-alpine

Nginx 1.21.3-alpine

GitHub Actions

Triggers of GitHub Actions workflow

  • push to any branch - running flake8 tests
  • push to master branch - pushing the app image to the DockerHub repository, running project on remote server, sending Telegram message about the successful completion of the workflow. Django app: collectstatic, migrate

Launch

DOCKER_USERNAME=<docker_username>
DOCKER_PASSWORD=<docker_password>
DOCKER_REPO=<docker_username>/<image name>
SERVER_HOST=<server_pub_ip>
SERVER_PASSPHRASE=<server_passphrase>
SERVER_USER=<username>
SSH_KEY=<--BEGIN OPENSSH PRIVATE KEY--...--END OPENSSH PRIVATE KEY--> # cat ~/.ssh/id_rsa
TELEGRAM_TO=<telegram_account_ID> # https://telegram.im/@userinfobot?lang=en
TELEGRAM_TOKEN=<telegram_bot_token> # https://t.me/botfather


- ENV_FILE variable value

DB_ENGINE=django.db.backends.postgresql
POSTGRES_DB=<database name>
POSTGRES_USER=<username>
POSTGRES_PASSWORD=<password> 
DB_HOST=db
DB_PORT=5432
DJANGO_SECRET_KEY=<Django_secret_key>
DOCKER_REPO=<docker_username>/<image name>
DOCKER_REPO_FRONTEND=<docker_username>/<image name>
SERVER_HOST=<server_pub_ip>
SERVER_URL=http://<server_pub_ip>/admin
  • Copy docker-compose.yml, nginx files and docs/ folder to the server.
scp <path_to_file>/docker-compose.yml <username>@<server_pub_ip>:/home/<username>
scp <path_to_file>/nginx.conf <username>@<server_pub_ip>:/home/<username>
scp -r <path_to_folder>/docs <username>@<server_pub_ip>:/home/<username>
  • Connect to the server.
ssh <username>@<server_pub_ip>

Install docker and compose plugin. Follow the steps after installing Docker Engine.

After activation and successful completion of the GitHub Actions workflow, the project is available at:

http://<server_pub_ip>/ http://<server_pub_ip>/admin/

  • Create superuser
docker compose exec web python manage.py createsuperuser
  • Enter test data into the database

docker compose exec web python manage.py loaddata dump.json

| Username  |  Email   | Password |
|-----------|----------|----------|
| User      | [email protected] | foodgram |
| AdminUser | [email protected] | foodgram |
| SuperUser | [email protected] | foodgram |
  • Create a database dump
docker compose exec web python manage.py dumpdata > db_dump.json

Author

NotMainCode (backend, containerization, CI/CD)

About

Foodgram project template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published