Skip to content

Commit

Permalink
[update] CORS header support
Browse files Browse the repository at this point in the history
  • Loading branch information
rkun123 committed Jul 7, 2021
1 parent 3291eea commit 0a511e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions server/server/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'colorfield',
'works',
'storages',
'corsheaders',
'rest_framework'
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'corsheaders.middleware.CorsMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
Expand Down Expand Up @@ -127,6 +128,11 @@
},
]

CORS_ALLOWED_ORIGINS = [
'https://shared-vps.compositecomputer.club',
'http://localhost:3000'
]


# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
Expand All @@ -151,8 +157,4 @@
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MEDIA_URL = '/media/'

CORS_ALLOWED_ORIGINS = [
'http://*'
]
MEDIA_URL = '/media/'
1 change: 1 addition & 0 deletions server/server/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

ALLOWED_HOSTS = ["*"]

CORS_ALLOW_ALL_ORIGINS = True

# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
Expand Down

0 comments on commit 0a511e5

Please sign in to comment.