Skip to content

Commit

Permalink
bug: move cors middleware to top of list
Browse files Browse the repository at this point in the history
remove whitenoise
  • Loading branch information
Chidi Orji committed Jul 28, 2019
1 parent 8cf0ab7 commit 993c8d1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 50 deletions.
1 change: 0 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pillow = "==5.4.1"
raven = "==6.10.0"
python-social-auth = "==0.3.6"
social-auth-app-django = "==3.1.0"
whitenoise = "==4.1.2"
psycopg2 = "==2.7.7"
dj-database-url = "==0.5.0"
drf-yasg = "==1.16.0"
Expand Down
67 changes: 30 additions & 37 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 6 additions & 12 deletions ethodoxy-api/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

PASSWORD_RESET_TIMEOUT_DAYS = 1
PASSWORD_RESET_TIMEOUT_DAYpiS = 1
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_METHODS = [
'GET',
]

DATABASES = {
'default': {
Expand All @@ -45,7 +49,6 @@
}

PREREQ_APPS = [
'whitenoise.runserver_nostatic',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
Expand All @@ -70,20 +73,12 @@
'drf_yasg',
]

CORS_ORIGIN_ALLOW_ALL = True

CORS_ALLOW_METHODS = [
'GET',
'POST',
]

INSTALLED_APPS = PREREQ_APPS + PROJECT_APPS + THIRD_PARTY_APPS

MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand Down Expand Up @@ -139,7 +134,6 @@
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage'

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

0 comments on commit 993c8d1

Please sign in to comment.