Skip to content

Sous-Vide-Zen/backend

Repository files navigation

Sous-Vide Zen Backend

linter PyTest

Sous-Vide Zen is a website for sharing and discovering recipes for sous-vide cooking, a technique that involves cooking food in vacuum-sealed bags at precise temperatures. Users can create their own recipes, browse popular and featured recipes, follow other users, react and comment on recipes, and save their favorites.

Features

  • Registration and authorization on the site
  • Share recipes
  • Popular recipes feed
  • Subscription feed
  • Share recipes
  • Comment recipes
  • Reactions to recipes and comments
  • Favorite recipes
  • Hash tags
  • Search recipe database

Technologies

  • Python 3.11
  • Django 4.2.6
  • Django REST Framework 3.14.0
  • PostgreSQL
  • Djoser
  • Black

How to start a project:

Clone the repository:

git clone git@github.com:Sous-Vide-Zen/backend.git

Navigate to the project directory:

cd backend

By Docker:

  1. If you don’t have Docker installed, please install it.
  2. Then execute it
    docker build -t svz-back .
  3. After it was built execute it
    docker run -p 8000:8000 svz-back

By venv:

Create and activate the virtual environment, install dependencies:
  • Windows
python -m venv venv
. venv/Scripts/activate
pip install -r src/requirements/requirements-dev.txt
  • Linux and macOS
python3.11 -m venv venv
. venv/bin/activate
pip install -r src/requirements/requirements-dev.txt

Now the application settings are divided into product and local. In order to use local settings, you need to create a file local_settings.py in the config/settings/ directory. An example of the file contents:

from pathlib import Path

DEBUG = True

BASE_DIR = Path(__file__).resolve().parent.parent.parent

ALLOWED_HOSTS = ["localhost", "127.0.0.1", "0.0.0.0"]

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": BASE_DIR / "db.sqlite3",
    }
}

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

SOCIAL_AUTH_VK_OAUTH2_KEY = "Your VK OAuth 2.0 key"
SOCIAL_AUTH_VK_OAUTH2_SECRET = "Your VK OAuth 2.0 secret"
SOCIAL_AUTH_YANDEX_OAUTH2_KEY = "Your Yandex OAuth 2.0 key"
SOCIAL_AUTH_YANDEX_OAUTH2_SECRET = "Your Yandex OAuth 2.0 secret"

CORS_ALLOW_ALL_ORIGINS = True

Create an env file and, if necessary, fill it with your variables or use default values.(This step can be skipped for local deployment)

cp .env.example .env

Launch a project:

python manage.py migrate
python manage.py runserver

Fill the database:

python manage.py loaddata $(ls src/fixtures/)

Documentation url

http://127.0.0.1:8000/api/v1/swagger/

Oauth endpoints:

Эндпоинты регистрации через соц.сети
http://127.0.0.1:8000/api/v1/login/yandex-oauth2/ - регистрация через яндекс
http://127.0.0.1:8000/api/v1/login/vk-oauth2 - регистрация через вк

Настройка редиректа, на проде нужно поменять 127.0.0.1:8000 на домен
http://127.0.0.1:8000/api/v1/complete/yandex-oauth2/ 
http://127.0.0.1:8000/api/v1/complete/vk-oauth2/ - настраивается в vk.com/dev

About

Sous Vide Zen Backend

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors