mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-26 11:34:00 +03:00
Updated settings to only include lists and ' (#930)
* Updated settings to only include lists and ' Substituted " with ' in files Migrated tuples to lists * Added trailing slashes - trailing slashes - minor cleanups
This commit is contained in:
parent
02d047c5b1
commit
65611f14ea
|
@ -34,7 +34,7 @@ if READ_DOT_ENV_FILE:
|
|||
|
||||
# APP CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
DJANGO_APPS = (
|
||||
DJANGO_APPS = [
|
||||
# Default Django apps:
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
|
@ -48,27 +48,27 @@ DJANGO_APPS = (
|
|||
|
||||
# Admin
|
||||
'django.contrib.admin',
|
||||
)
|
||||
THIRD_PARTY_APPS = (
|
||||
]
|
||||
THIRD_PARTY_APPS = [
|
||||
'crispy_forms', # Form layouts
|
||||
'allauth', # registration
|
||||
'allauth.account', # registration
|
||||
'allauth.socialaccount', # registration
|
||||
)
|
||||
]
|
||||
|
||||
# Apps specific for this project go here.
|
||||
LOCAL_APPS = (
|
||||
LOCAL_APPS = [
|
||||
# custom users app
|
||||
'{{ cookiecutter.project_slug }}.users.apps.UsersConfig',
|
||||
# Your stuff: custom apps go here
|
||||
)
|
||||
]
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
|
||||
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
|
||||
|
||||
# MIDDLEWARE CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
MIDDLEWARE = (
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
|
@ -76,7 +76,7 @@ MIDDLEWARE = (
|
|||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
]
|
||||
|
||||
# MIGRATIONS CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -103,9 +103,9 @@ EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.s
|
|||
# MANAGER CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
|
||||
ADMINS = (
|
||||
ADMINS = [
|
||||
("""{{cookiecutter.author_name}}""", '{{cookiecutter.email}}'),
|
||||
)
|
||||
]
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
|
||||
MANAGERS = ADMINS
|
||||
|
@ -190,15 +190,15 @@ STATIC_ROOT = str(ROOT_DIR('staticfiles'))
|
|||
STATIC_URL = '/static/'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
|
||||
STATICFILES_DIRS = (
|
||||
STATICFILES_DIRS = [
|
||||
str(APPS_DIR.path('static')),
|
||||
)
|
||||
]
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
|
||||
STATICFILES_FINDERS = (
|
||||
STATICFILES_FINDERS = [
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
)
|
||||
]
|
||||
|
||||
# MEDIA CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -237,10 +237,10 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
|
||||
# AUTHENTICATION CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
'allauth.account.auth_backends.AuthenticationBackend',
|
||||
)
|
||||
]
|
||||
|
||||
# Some really nice defaults
|
||||
ACCOUNT_AUTHENTICATION_METHOD = 'username'
|
||||
|
@ -261,9 +261,9 @@ LOGIN_URL = 'account_login'
|
|||
AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
|
||||
{% if cookiecutter.use_celery == 'y' %}
|
||||
########## CELERY
|
||||
INSTALLED_APPS += ('{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig',)
|
||||
INSTALLED_APPS += ['{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig']
|
||||
# if you are not using the django database broker (e.g. rabbitmq, redis, memcached), you can remove the next line.
|
||||
INSTALLED_APPS += ('kombu.transport.django',)
|
||||
INSTALLED_APPS += ['kombu.transport.django']
|
||||
BROKER_URL = env('CELERY_BROKER_URL', default='django://')
|
||||
if BROKER_URL == 'django://':
|
||||
CELERY_RESULT_BACKEND = 'redis://'
|
||||
|
@ -275,8 +275,8 @@ else:
|
|||
{%- if cookiecutter.use_compressor == 'y'-%}
|
||||
# django-compressor
|
||||
# ------------------------------------------------------------------------------
|
||||
INSTALLED_APPS += ("compressor", )
|
||||
STATICFILES_FINDERS += ("compressor.finders.CompressorFinder", )
|
||||
INSTALLED_APPS += ['compressor']
|
||||
STATICFILES_FINDERS += ['compressor.finders.CompressorFinder']
|
||||
{%- endif %}
|
||||
|
||||
# Location of root django.contrib.admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %}
|
||||
|
|
|
@ -32,7 +32,7 @@ SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!')
|
|||
|
||||
EMAIL_PORT = 1025
|
||||
{% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %}
|
||||
EMAIL_HOST = env("EMAIL_HOST", default='mailhog')
|
||||
EMAIL_HOST = env('EMAIL_HOST', default='mailhog')
|
||||
{% else %}
|
||||
EMAIL_HOST = 'localhost'
|
||||
EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND',
|
||||
|
@ -50,14 +50,14 @@ CACHES = {
|
|||
|
||||
# django-debug-toolbar
|
||||
# ------------------------------------------------------------------------------
|
||||
MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
|
||||
INSTALLED_APPS += ('debug_toolbar', )
|
||||
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ]
|
||||
INSTALLED_APPS += ['debug_toolbar', ]
|
||||
|
||||
INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ]
|
||||
# tricks to have debug toolbar when developing with docker
|
||||
if os.environ.get('USE_DOCKER') == 'yes':
|
||||
ip = socket.gethostbyname(socket.gethostname())
|
||||
INTERNAL_IPS += [ip[:-1] + "1"]
|
||||
INTERNAL_IPS += [ip[:-1] + '1']
|
||||
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
'DISABLE_PANELS': [
|
||||
|
@ -68,7 +68,7 @@ DEBUG_TOOLBAR_CONFIG = {
|
|||
|
||||
# django-extensions
|
||||
# ------------------------------------------------------------------------------
|
||||
INSTALLED_APPS += ('django_extensions', )
|
||||
INSTALLED_APPS += ['django_extensions', ]
|
||||
|
||||
# TESTING
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -36,30 +36,28 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|||
{%- if cookiecutter.use_sentry_for_error_reporting == 'y' %}
|
||||
# raven sentry client
|
||||
# See https://docs.sentry.io/clients/python/integrations/django/
|
||||
INSTALLED_APPS += ('raven.contrib.django.raven_compat', )
|
||||
INSTALLED_APPS += ['raven.contrib.django.raven_compat', ]
|
||||
{% endif %}
|
||||
{%- if cookiecutter.use_whitenoise == 'y' %}
|
||||
# Use Whitenoise to serve static files
|
||||
# See: https://whitenoise.readthedocs.io/
|
||||
WHITENOISE_MIDDLEWARE = ('whitenoise.middleware.WhiteNoiseMiddleware', )
|
||||
WHITENOISE_MIDDLEWARE = ['whitenoise.middleware.WhiteNoiseMiddleware', ]
|
||||
MIDDLEWARE = WHITENOISE_MIDDLEWARE + MIDDLEWARE
|
||||
{% endif %}
|
||||
{%- if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
|
||||
RAVEN_MIDDLEWARE = ('raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', )
|
||||
RAVEN_MIDDLEWARE = ['raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware']
|
||||
MIDDLEWARE = RAVEN_MIDDLEWARE + MIDDLEWARE
|
||||
{% endif %}
|
||||
{%- if cookiecutter.use_opbeat == 'y' -%}
|
||||
# opbeat integration
|
||||
# See https://opbeat.com/languages/django/
|
||||
INSTALLED_APPS += ('opbeat.contrib.django',)
|
||||
INSTALLED_APPS += ['opbeat.contrib.django', ]
|
||||
OPBEAT = {
|
||||
'ORGANIZATION_ID': env('DJANGO_OPBEAT_ORGANIZATION_ID'),
|
||||
'APP_ID': env('DJANGO_OPBEAT_APP_ID'),
|
||||
'SECRET_TOKEN': env('DJANGO_OPBEAT_SECRET_TOKEN')
|
||||
}
|
||||
MIDDLEWARE = (
|
||||
'opbeat.contrib.django.middleware.OpbeatAPMMiddleware',
|
||||
) + MIDDLEWARE
|
||||
MIDDLEWARE = ['opbeat.contrib.django.middleware.OpbeatAPMMiddleware', ] + MIDDLEWARE
|
||||
{% endif %}
|
||||
|
||||
# SECURITY CONFIGURATION
|
||||
|
@ -85,10 +83,10 @@ X_FRAME_OPTIONS = 'DENY'
|
|||
# ------------------------------------------------------------------------------
|
||||
# Hosts/domain names that are valid for this site
|
||||
# See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain_name}}'])
|
||||
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain_name}}', ])
|
||||
# END SITE CONFIGURATION
|
||||
|
||||
INSTALLED_APPS += ('gunicorn', )
|
||||
INSTALLED_APPS += ['gunicorn', ]
|
||||
|
||||
|
||||
# STORAGE CONFIGURATION
|
||||
|
@ -96,9 +94,7 @@ INSTALLED_APPS += ('gunicorn', )
|
|||
# Uploaded Media Files
|
||||
# ------------------------
|
||||
# See: http://django-storages.readthedocs.io/en/latest/index.html
|
||||
INSTALLED_APPS += (
|
||||
'storages',
|
||||
)
|
||||
INSTALLED_APPS += ['storages', ]
|
||||
|
||||
AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID')
|
||||
AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
|
||||
|
@ -143,7 +139,7 @@ STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage'
|
|||
# For Django 1.7+, 'collectfast' should come before
|
||||
# 'django.contrib.staticfiles'
|
||||
AWS_PRELOAD_METADATA = True
|
||||
INSTALLED_APPS = ('collectfast', ) + INSTALLED_APPS
|
||||
INSTALLED_APPS = ['collectfast', ] + INSTALLED_APPS
|
||||
{%- endif %}
|
||||
{% if cookiecutter.use_compressor == 'y'-%}
|
||||
# COMPRESSOR
|
||||
|
@ -156,16 +152,16 @@ COMPRESS_ENABLED = env.bool('COMPRESS_ENABLED', default=True)
|
|||
# ------------------------------------------------------------------------------
|
||||
DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL',
|
||||
default='{{cookiecutter.project_name}} <noreply@{{cookiecutter.domain_name}}>')
|
||||
EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX', default='[{{cookiecutter.project_name}}] ')
|
||||
EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX', default='[{{cookiecutter.project_name}}]')
|
||||
SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL)
|
||||
|
||||
# Anymail with Mailgun
|
||||
INSTALLED_APPS += ("anymail", )
|
||||
INSTALLED_APPS += ['anymail', ]
|
||||
ANYMAIL = {
|
||||
"MAILGUN_API_KEY": env('DJANGO_MAILGUN_API_KEY'),
|
||||
"MAILGUN_SENDER_DOMAIN": env('MAILGUN_SENDER_DOMAIN')
|
||||
'MAILGUN_API_KEY': env('DJANGO_MAILGUN_API_KEY'),
|
||||
'MAILGUN_SENDER_DOMAIN': env('MAILGUN_SENDER_DOMAIN')
|
||||
}
|
||||
EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend"
|
||||
EMAIL_BACKEND = 'anymail.backends.mailgun.MailgunBackend'
|
||||
|
||||
# TEMPLATE CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -199,7 +195,7 @@ DATABASES['default'] = env.db('DATABASE_URL')
|
|||
# CACHING
|
||||
# ------------------------------------------------------------------------------
|
||||
{% if cookiecutter.use_elasticbeanstalk_experimental.lower() == 'y' -%}
|
||||
REDIS_LOCATION = "redis://{}:{}/0".format(
|
||||
REDIS_LOCATION = 'redis://{}:{}/0'.format(
|
||||
env('REDIS_ENDPOINT_ADDRESS'),
|
||||
env('REDIS_PORT')
|
||||
)
|
||||
|
@ -228,7 +224,7 @@ LOGGING = {
|
|||
'disable_existing_loggers': True,
|
||||
'root': {
|
||||
'level': 'WARNING',
|
||||
'handlers': ['sentry'],
|
||||
'handlers': ['sentry', ],
|
||||
},
|
||||
'formatters': {
|
||||
'verbose': {
|
||||
|
@ -250,22 +246,22 @@ LOGGING = {
|
|||
'loggers': {
|
||||
'django.db.backends': {
|
||||
'level': 'ERROR',
|
||||
'handlers': ['console'],
|
||||
'handlers': ['console', ],
|
||||
'propagate': False,
|
||||
},
|
||||
'raven': {
|
||||
'level': 'DEBUG',
|
||||
'handlers': ['console'],
|
||||
'handlers': ['console', ],
|
||||
'propagate': False,
|
||||
},
|
||||
'sentry.errors': {
|
||||
'level': 'DEBUG',
|
||||
'handlers': ['console'],
|
||||
'handlers': ['console', ],
|
||||
'propagate': False,
|
||||
},
|
||||
'django.security.DisallowedHost': {
|
||||
'level': 'ERROR',
|
||||
'handlers': ['console', 'sentry'],
|
||||
'handlers': ['console', 'sentry', ],
|
||||
'propagate': False,
|
||||
},
|
||||
},
|
||||
|
@ -301,7 +297,7 @@ LOGGING = {
|
|||
'handlers': {
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'filters': ['require_debug_false'],
|
||||
'filters': ['require_debug_false', ],
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
},
|
||||
'console': {
|
||||
|
@ -312,13 +308,13 @@ LOGGING = {
|
|||
},
|
||||
'loggers': {
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'handlers': ['mail_admins', ],
|
||||
'level': 'ERROR',
|
||||
'propagate': True
|
||||
},
|
||||
'django.security.DisallowedHost': {
|
||||
'level': 'ERROR',
|
||||
'handlers': ['console', 'mail_admins'],
|
||||
'handlers': ['console', 'mail_admins', ],
|
||||
'propagate': True
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,16 +47,16 @@ TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
|||
# PASSWORD HASHING
|
||||
# ------------------------------------------------------------------------------
|
||||
# Use fast password hasher so tests run faster
|
||||
PASSWORD_HASHERS = (
|
||||
PASSWORD_HASHERS = [
|
||||
'django.contrib.auth.hashers.MD5PasswordHasher',
|
||||
)
|
||||
]
|
||||
|
||||
# TEMPLATE LOADERS
|
||||
# ------------------------------------------------------------------------------
|
||||
# Keep templates in memory so tests run faster
|
||||
TEMPLATES[0]['OPTIONS']['loaders'] = [
|
||||
('django.template.loaders.cached.Loader', [
|
||||
['django.template.loaders.cached.Loader', [
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
]),
|
||||
], ],
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue
Block a user