mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-11 04:07:48 +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" %}
|
||||
"rest_framework",
|
||||
"rest_framework.authtoken",
|
||||
"corsheaders",
|
||||
{%- endif %}
|
||||
]
|
||||
|
||||
|
@ -134,6 +135,9 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
# https://docs.djangoproject.com/en/dev/ref/settings/#middleware
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
{%- if cookiecutter.use_drf == 'y' %}
|
||||
"corsheaders.middleware.CorsMiddleware",
|
||||
{%- endif %}
|
||||
{%- if cookiecutter.use_whitenoise == 'y' %}
|
||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||
{%- endif %}
|
||||
|
@ -321,6 +325,12 @@ REST_FRAMEWORK = {
|
|||
),
|
||||
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
|
||||
}
|
||||
|
||||
# django-cors-headers - https://github.com/adamchainz/django-cors-headers#setup
|
||||
CORS_URLS_REGEX = {
|
||||
r'^/api.*$',
|
||||
}
|
||||
|
||||
{%- endif %}
|
||||
# Your stuff...
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user