Skip to content

Commit

Permalink
add cors headers
Browse files Browse the repository at this point in the history
  • Loading branch information
dori-dev committed Mar 24, 2023
1 parent cb72b0d commit df04ad9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion requirements/production.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-r common.txt
gunicorn==20.1.0
gunicorn==20.1.0
django-cors-headers==3.14.0
9 changes: 3 additions & 6 deletions src/config/settings/development.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
from .base import *

THIRD_PARTY_APPS = [
'django_extensions',
'debug_toolbar',
]

INSTALLED_APPS = [
*BASE_INSTALLED_APPS,
*THIRD_PARTY_APPS,
'django_extensions',
'debug_toolbar',
]

MIDDLEWARE = [
"debug_toolbar.middleware.DebugToolbarMiddleware",
*BASE_MIDDLEWARE,
"debug_toolbar.middleware.DebugToolbarMiddleware",
]

DEBUG = True
Expand Down
3 changes: 3 additions & 0 deletions src/config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@

INSTALLED_APPS = [
*BASE_INSTALLED_APPS,
'corsheaders',
]

MIDDLEWARE = [
*BASE_MIDDLEWARE,
'corsheaders.middleware.CorsMiddleware',
]

DEBUG = True

ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '').split(',')
CSRF_TRUSTED_ORIGINS = [f"https://{host}" for host in ALLOWED_HOSTS]

STATIC_ROOT = os.getenv('STATIC_ROOT', 'staticfiles')

Expand Down

0 comments on commit df04ad9

Please sign in to comment.