diff --git a/app/project/settings.py b/app/project/settings.py index 2b255a2..887c50c 100644 --- a/app/project/settings.py +++ b/app/project/settings.py @@ -5,7 +5,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = os.environ.get('SECRET_KEY', 'django-debug-key') -DEBUG = os.environ.get('DEBUG', True) +DEBUG = bool(int(os.environ.get('DEBUG', True))) ALLOWED_HOSTS = ['*'] @@ -94,3 +94,5 @@ CORS_ALLOWED_ORIGINS = [ 'http://localhost:443', 'http://localhost:80', ] +if DEBUG: + CORS_ALLOW_ALL_ORIGINS = True diff --git a/app/users/views.py b/app/users/views.py index 6994a2a..82917a7 100644 --- a/app/users/views.py +++ b/app/users/views.py @@ -6,7 +6,7 @@ from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt -from django.views.decorators.http import require_POST +from django.views.decorators.http import require_POST, require_GET from users.models import Token @@ -29,7 +29,7 @@ def login(request): return JsonResponse({'token': token[0].token}) -@require_POST +@require_GET @csrf_exempt def check_token(request): auth_header = request.headers.get('Authorization') diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 5e928d3..02482bf 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -1,24 +1,24 @@ version: '3.9' services: - web: - build: ./app - # place image - command: > - sh -c " - python manage.py makemigrations --noinput && - python manage.py migrate --noinput && - python manage.py runserver 0.0.0.0:8000 - " - ports: - - '8000:8000' - expose: - - 8000 - env_file: - - .env - depends_on: - postgres: - condition: service_healthy +# web: +# build: ./app +# # place image +# command: > +# sh -c " +# python manage.py makemigrations --noinput && +# python manage.py migrate --noinput && +# python manage.py runserver 0.0.0.0:8000 +# " +# ports: +# - '8000:8000' +# expose: +# - 8000 +# env_file: +# - .env +# depends_on: +# postgres: +# condition: service_healthy postgres: image: postgres:15