From 14ac6229d37eedbfa370c45ca574fc8be0c3c72f Mon Sep 17 00:00:00 2001 From: Jakub K Date: Thu, 1 Feb 2024 22:46:23 +0100 Subject: [PATCH] add allowed hosts --- izaac/settings.py | 2 +- jobposting/views.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/izaac/settings.py b/izaac/settings.py index dba85dd..be2ae79 100644 --- a/izaac/settings.py +++ b/izaac/settings.py @@ -30,7 +30,7 @@ SECRET_KEY = "django-insecure-ztiqj957k(j*@ms=-^9j+=j7wd+cyo*+9g&hkfh1bji-@#&6(e # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = ['izaac.izaac.pl', 'localhost', '127.0.0.1',] +ALLOWED_HOSTS = ['izaac.izaac.pl', 'localhost', '127.0.0.1', 'izaac'] CORS_ALLOW_ALL_ORIGINS = True diff --git a/jobposting/views.py b/jobposting/views.py index 5b57efe..48d48d8 100644 --- a/jobposting/views.py +++ b/jobposting/views.py @@ -111,6 +111,8 @@ class GetAuthTokenView(APIView): } print(headers) print("DATA READY") - response = requests.post('http://localhost:8000/o/token/', headers=headers, data=data) - print(response.text) - return Response(response.json()) \ No newline at end of file + try: + response = requests.post('http://localhost:8000/o/token/', headers=headers, data=data) + return Response(response.json()) + except: + print("ERROR") \ No newline at end of file