Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabilya committed Apr 21, 2024
1 parent 93b1450 commit 0bcf82b
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: foodgram workflow
name: cookingconnect workflow

on: [push]

Expand Down Expand Up @@ -87,4 +87,4 @@ jobs:
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: Деплой успешно выполнен!
message: Деплой успешно выполнен!
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ touch .env

```python
DB_ENGINE='django.db.backends.postgresql'
POSTGRES_DB='foodgram' # Задаем имя для БД.
POSTGRES_DB='cookingconnect' # Задаем имя для БД.
POSTGRES_USER='foodgram_u' # Задаем пользователя для БД.
POSTGRES_PASSWORD='foodgram_u_pass' # Задаем пароль для БД.
DB_HOST='db'
Expand Down Expand Up @@ -152,13 +152,18 @@ docker-compose down -v
Для доступа к контейнеру backend и сборки финальной части выполняем следующие команды:

```bash
docker-compose exec backend python manage.py makemigrations
docker-compose exec backend python manage.py makemigrations users
docker-compose exec backend python manage.py makemigrations recipes

```

```bash
docker-compose exec backend python manage.py migrate --noinput
```

```bash
docker compose exec backend python manage.py load_tags
docker compose exec backend python manage.py load_ingrs
```
```bash
docker-compose exec backend python manage.py createsuperuser
```
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM python:3.7-slim
WORKDIR /app
COPY . .
RUN pip3 install --upgrade pip && pip3 install -r ./requirements.txt --no-cache-dir
CMD ["gunicorn", "foodgram.wsgi:application", "--bind", "0.0.0.0:8000"]
CMD ["gunicorn", "cookingconnect.wsgi:application", "--bind", "0.0.0.0:8000"]
2 changes: 1 addition & 1 deletion backend/api/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.urls import include, path
from rest_framework.routers import DefaultRouter

from .views import IngredientViewSet, RecipeViewSet, TagViewSet
from api.views import IngredientViewSet, RecipeViewSet, TagViewSet
from users.views import UserViewSet

router = DefaultRouter()
Expand Down
2 changes: 1 addition & 1 deletion backend/api/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from rest_framework import serializers
from webcolors import hex_to_name

from foodgram.settings import INGREDIENT_MIN, INGREDIENT_MAX
from cookingconnect.settings import INGREDIENT_MAX, INGREDIENT_MIN


def validate_colorfield(value):
Expand Down
2 changes: 1 addition & 1 deletion backend/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from recipes.models import (Favorite, Ingredient, Recipe, ShoppingCart, Tag)
from .permissions import IsAuthorOrAdminOrReadOnly

from .serializers import (
from api.serializers import (
FavoriteSerializer,
IngredientSerializer,
RecipeCreateSerializer,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'foodgram.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cookingconnect.settings')

application = get_asgi_application()
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'foodgram.urls'
ROOT_URLCONF = 'cookingconnect.urls'

TEMPLATES = [
{
Expand All @@ -64,13 +64,13 @@
},
]

WSGI_APPLICATION = 'foodgram.wsgi.application'
WSGI_APPLICATION = 'cookingconnect.wsgi.application'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.getenv('POSTGRES_DB', 'foodgram'),
'USER': os.getenv('POSTGRES_USER', 'foodgram_user'),
'NAME': os.getenv('POSTGRES_DB', 'cookingconnect'),
'USER': os.getenv('POSTGRES_USER', 'cookingconnect_user'),
'PASSWORD': os.getenv('POSTGRES_PASSWORD', ''),
'HOST': os.getenv('DB_HOST', 'db'),
'PORT': os.getenv('DB_PORT', 5432)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'foodgram.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cookingconnect.settings')

application = get_wsgi_application()
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion backend/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'foodgram.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cookingconnect.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
4 changes: 2 additions & 2 deletions infra/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
nginx:
image: nginx:1.21.3-alpine
ports:
- "8000:80"
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./docs/:/usr/share/nginx/html/api/docs/
Expand All @@ -40,4 +40,4 @@ services:
volumes:
static_value:
media_value:
frontend_value:
frontend_value:
3 changes: 1 addition & 2 deletions infra/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
server {

listen 80;
server_name foodgramfabilya.bounceme.net;
server_name localhost;
client_max_body_size 20M;

location /static/admin/ {
Expand All @@ -16,7 +16,6 @@ server {

location /media/ {
root /var/html/;
autoindex on;
}

location /api/ {
Expand Down

0 comments on commit 0bcf82b

Please sign in to comment.