diff --git a/backend/.env.local b/backend/.env.local index e0f9789..9f27c2c 100644 --- a/backend/.env.local +++ b/backend/.env.local @@ -1,6 +1,4 @@ ### keep the env name to .env.local if you want to change this .env name you should change it in django setting too when you load this env - -DEBUG = True # keep debug true to set the database to sqlite # postgres database info DB_NAME = 'hshop' DB_USER = 'byeto' diff --git a/backend/account/views.py b/backend/account/views.py index ad91bc4..b731b0d 100644 --- a/backend/account/views.py +++ b/backend/account/views.py @@ -177,11 +177,12 @@ class GetIDUserAddressView(generics.RetrieveAPIView): class SubscribeView(APIView): serializer_class = PushSubscriptionSerializer + permission_classes = [IsAuthenticated] def post(self, request): push_ser = self.serializer_class(data=request.data) if push_ser.is_valid(): PushSubscription.objects.update_or_create( - user=User.objects.all().first(), + user=request.user, defaults=(push_ser.validated_data) ) return Response(status=status.HTTP_201_CREATED) diff --git a/backend/core/asgi.py b/backend/core/asgi.py index e718260..f1335da 100644 --- a/backend/core/asgi.py +++ b/backend/core/asgi.py @@ -11,6 +11,6 @@ import os from django.core.asgi import get_asgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings.production') application = get_asgi_application() diff --git a/backend/core/wsgi.py b/backend/core/wsgi.py index 94b58d7..63445b4 100644 --- a/backend/core/wsgi.py +++ b/backend/core/wsgi.py @@ -11,6 +11,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings.production') application = get_wsgi_application() diff --git a/backend/dockerfile b/backend/dockerfile index 9e24e11..a52545a 100644 --- a/backend/dockerfile +++ b/backend/dockerfile @@ -11,4 +11,7 @@ RUN pip install --no-cache-dir -r requirements.txt COPY . /app/ -CMD ["sh", "-c", "python manage.py makemigrations && python manage.py migrate && python manage.py collectstatic && python manage.py runserver 0.0.0.0:8000"] \ No newline at end of file +CMD ["sh", "-c", "python manage.py makemigrations && \ + python manage.py migrate && \ + python manage.py collectstatic --no-input && \ + gunicorn core.wsgi:application --bind 0.0.0.0:8000 --workers 3"] \ No newline at end of file diff --git a/backend/requirements.txt b/backend/requirements.txt index 83cdbca..29093dc 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -48,6 +48,7 @@ geoip2==4.8.0 ghasedak_sms==1.0.3 ghasedakpack==0.1.13 gnupg==2.3.1 +gunicorn==23.0.0 h11==0.14.0 http_ece==1.2.1 httpagentparser==1.9.5 @@ -73,6 +74,7 @@ oauthlib==3.2.2 odfpy==1.4.1 openai==1.58.1 openpyxl==3.1.2 +packaging==24.2 pillow==10.4.0 platformdirs==4.2.2 propcache==0.2.0 diff --git a/docker-compose.yml b/docker-compose.yml index eded502..66ea3cc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,7 @@ services: [ "sh", "-c", - "python manage.py migrate && python manage.py collectstatic --no-input && python manage.py runserver 0.0.0.0:8000", + "python manage.py migrate && python manage.py collectstatic --no-input && gunicorn core.wsgi:application --bind 0.0.0.0:8000 --workers 3", ] networks: - default diff --git a/frontend/app.vue b/frontend/app.vue index 7c4c63c..c717a1c 100644 --- a/frontend/app.vue +++ b/frontend/app.vue @@ -1,4 +1,7 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/frontend/components/global/BlogPost.vue b/frontend/components/global/BlogPost.vue index 76f425f..f50bd67 100644 --- a/frontend/components/global/BlogPost.vue +++ b/frontend/components/global/BlogPost.vue @@ -22,15 +22,15 @@ const {} = toRefs(props);