mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-10 16:12:29 +03:00
Added django-cors-headers setup steps to base settings
This commit is contained in:
parent
1526aafab3
commit
eafe74262a
|
@ -80,6 +80,7 @@ THIRD_PARTY_APPS = [
|
||||||
{%- if cookiecutter.use_drf == "y" %}
|
{%- if cookiecutter.use_drf == "y" %}
|
||||||
"rest_framework",
|
"rest_framework",
|
||||||
"rest_framework.authtoken",
|
"rest_framework.authtoken",
|
||||||
|
"corsheaders",
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -134,6 +135,9 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#middleware
|
# https://docs.djangoproject.com/en/dev/ref/settings/#middleware
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
"django.middleware.security.SecurityMiddleware",
|
"django.middleware.security.SecurityMiddleware",
|
||||||
|
{%- if cookiecutter.use_drf == 'y' %}
|
||||||
|
"corsheaders.middleware.CorsMiddleware",
|
||||||
|
{%- endif %}
|
||||||
{%- if cookiecutter.use_whitenoise == 'y' %}
|
{%- if cookiecutter.use_whitenoise == 'y' %}
|
||||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -321,6 +325,12 @@ REST_FRAMEWORK = {
|
||||||
),
|
),
|
||||||
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
|
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# django-cors-headers - https://github.com/adamchainz/django-cors-headers#setup
|
||||||
|
CORS_URLS_REGEX = {
|
||||||
|
r'^/api.*$',
|
||||||
|
}
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
# Your stuff...
|
# Your stuff...
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user