mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-11 12:17:37 +03:00
Eliminate empty spaces generated on Jinja on
config/settings/production.py
This commit is contained in:
parent
54575f02de
commit
a7eb85208d
|
@ -29,33 +29,26 @@ from .common import * # noqa
|
||||||
# Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ
|
# Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ
|
||||||
SECRET_KEY = env('DJANGO_SECRET_KEY')
|
SECRET_KEY = env('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
|
||||||
# This ensures that Django will be able to detect a secure connection
|
# This ensures that Django will be able to detect a secure connection
|
||||||
# properly on Heroku.
|
# properly on Heroku.
|
||||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||||
|
{%- if cookiecutter.use_sentry == 'y'-%}
|
||||||
{% if cookiecutter.use_sentry == 'y' -%}
|
|
||||||
# raven sentry client
|
# raven sentry client
|
||||||
# See https://docs.getsentry.com/hosted/clients/python/integrations/django/
|
# See https://docs.getsentry.com/hosted/clients/python/integrations/django/
|
||||||
INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
|
INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
|
||||||
{%- endif %}
|
{% endif %}
|
||||||
|
{%- if cookiecutter.use_whitenoise == 'y' %}
|
||||||
{% if cookiecutter.use_whitenoise == 'y' -%}
|
|
||||||
# Use Whitenoise to serve static files
|
# Use Whitenoise to serve static files
|
||||||
# See: https://whitenoise.readthedocs.io/
|
# See: https://whitenoise.readthedocs.io/
|
||||||
WHITENOISE_MIDDLEWARE = (
|
WHITENOISE_MIDDLEWARE = ('whitenoise.middleware.WhiteNoiseMiddleware', )
|
||||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
|
||||||
)
|
|
||||||
MIDDLEWARE_CLASSES = WHITENOISE_MIDDLEWARE + MIDDLEWARE_CLASSES
|
MIDDLEWARE_CLASSES = WHITENOISE_MIDDLEWARE + MIDDLEWARE_CLASSES
|
||||||
{%- endif %}
|
{% endif %}
|
||||||
{% if cookiecutter.use_sentry == 'y' -%}
|
{%- if cookiecutter.use_sentry == 'y' -%}
|
||||||
RAVEN_MIDDLEWARE = (
|
RAVEN_MIDDLEWARE = ('raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', )
|
||||||
'raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware',
|
|
||||||
)
|
|
||||||
MIDDLEWARE_CLASSES = RAVEN_MIDDLEWARE + MIDDLEWARE_CLASSES
|
MIDDLEWARE_CLASSES = RAVEN_MIDDLEWARE + MIDDLEWARE_CLASSES
|
||||||
{%- endif %}
|
{% endif %}
|
||||||
|
{%- if cookiecutter.use_opbeat == 'y' -%}
|
||||||
|
|
||||||
{% if cookiecutter.use_opbeat == 'y' -%}
|
|
||||||
# opbeat integration
|
# opbeat integration
|
||||||
# See https://opbeat.com/languages/django/
|
# See https://opbeat.com/languages/django/
|
||||||
INSTALLED_APPS += ('opbeat.contrib.django',)
|
INSTALLED_APPS += ('opbeat.contrib.django',)
|
||||||
|
@ -67,7 +60,7 @@ OPBEAT = {
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
'opbeat.contrib.django.middleware.OpbeatAPMMiddleware',
|
'opbeat.contrib.django.middleware.OpbeatAPMMiddleware',
|
||||||
) + MIDDLEWARE_CLASSES
|
) + MIDDLEWARE_CLASSES
|
||||||
{%- endif %}
|
{% endif %}
|
||||||
|
|
||||||
# SECURITY CONFIGURATION
|
# SECURITY CONFIGURATION
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -81,14 +74,11 @@ SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool(
|
||||||
SECURE_CONTENT_TYPE_NOSNIFF = env.bool(
|
SECURE_CONTENT_TYPE_NOSNIFF = env.bool(
|
||||||
'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True)
|
'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True)
|
||||||
SECURE_BROWSER_XSS_FILTER = True
|
SECURE_BROWSER_XSS_FILTER = True
|
||||||
|
|
||||||
SESSION_COOKIE_SECURE = True
|
SESSION_COOKIE_SECURE = True
|
||||||
SESSION_COOKIE_HTTPONLY = True
|
SESSION_COOKIE_HTTPONLY = True
|
||||||
|
|
||||||
SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True)
|
SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True)
|
||||||
CSRF_COOKIE_SECURE = True
|
CSRF_COOKIE_SECURE = True
|
||||||
CSRF_COOKIE_HTTPONLY = True
|
CSRF_COOKIE_HTTPONLY = True
|
||||||
|
|
||||||
X_FRAME_OPTIONS = 'DENY'
|
X_FRAME_OPTIONS = 'DENY'
|
||||||
|
|
||||||
# SITE CONFIGURATION
|
# SITE CONFIGURATION
|
||||||
|
@ -100,6 +90,7 @@ ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain
|
||||||
|
|
||||||
INSTALLED_APPS += ('gunicorn', )
|
INSTALLED_APPS += ('gunicorn', )
|
||||||
|
|
||||||
|
|
||||||
# STORAGE CONFIGURATION
|
# STORAGE CONFIGURATION
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Uploaded Media Files
|
# Uploaded Media Files
|
||||||
|
|
Loading…
Reference in New Issue
Block a user