File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -343,6 +343,7 @@ def skip_unreadable_post(record):
343343
344344MIDDLEWARE = (
345345 'django.middleware.csrf.CsrfViewMiddleware' ,
346+ 'corsheaders.middleware.CorsMiddleware' , # see docs on CORS_REPLACE_HTTPS_REFERER before using it
346347 'django.middleware.common.CommonMiddleware' ,
347348 'django.contrib.sessions.middleware.SessionMiddleware' ,
348349 'django.contrib.auth.middleware.AuthenticationMiddleware' ,
@@ -382,6 +383,7 @@ def skip_unreadable_post(record):
382383 # External apps
383384 'anora' ,
384385 'bootstrap3' ,
386+ 'corsheaders' ,
385387 'django_markup' ,
386388 'django_password_strength' ,
387389 'djangobwr' ,
@@ -455,6 +457,12 @@ def skip_unreadable_post(record):
455457
456458}
457459
460+ # CORS settings
461+ # See https://github.com/ottoyiu/django-cors-headers/
462+ CORS_ORIGIN_ALLOW_ALL = True
463+ CORS_ALLOW_METHODS = ( 'GET' , 'OPTIONS' , )
464+ CORS_URLS_REGEX = r'^(/api/.*|.*\.json|.*/json/?)$'
465+
458466# Override this in your settings_local with the IP addresses relevant for you:
459467INTERNAL_IPS = (
460468# local
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ defusedxml>=0.4.1 # for TastyPie when ussing xml; not a declared dependency
1313Django >= 1.11 ,< 1.12
1414django-bcrypt >= 0.9.2 # for the BCrypt password hasher option. Remove when all bcrypt upgraded to argon2
1515django-bootstrap3 >= 8.2.1 ,< 9.0.0
16+ django-cors-headers >= 2.4.0
1617django-formtools >= 1.0 # instead of django.contrib.formtools in 1.8
1718django-markup >= 1.1
1819django-password-strength >= 1.2.1
You can’t perform that action at this time.
0 commit comments