mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 17:47:08 +03:00
refractor(settings): break up the settings into one module per configuration
- moves urls.py to project_root - moves wsgi.py to project_root - 'config.settings' is replaced by 'config', selectively applicable configs are imported in '__init__.py' fixes: #47
This commit is contained in:
parent
1701aed142
commit
81576069f8
|
@ -1 +1 @@
|
|||
web: gunicorn --pythonpath="$PWD/{{cookiecutter.repo_name}}" config.wsgi:application
|
||||
web: gunicorn --pythonpath="$PWD/{{cookiecutter.repo_name}}" wsgi:application
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .local import Local # noqa
|
||||
from .production import Production # noqa
|
|
@ -11,24 +11,16 @@ https://docs.djangoproject.com/en/dev/ref/settings/
|
|||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
import os
|
||||
from os.path import join
|
||||
|
||||
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
|
||||
try:
|
||||
from S3 import CallingFormat
|
||||
AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN
|
||||
except ImportError:
|
||||
# TODO: Fix this where even if in Dev this class is called.
|
||||
pass
|
||||
from os.path import join, dirname
|
||||
|
||||
from configurations import Configuration, values
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
BASE_DIR = dirname(dirname(__file__))
|
||||
|
||||
|
||||
class Common(Configuration):
|
||||
|
||||
########## APP CONFIGURATION
|
||||
# APP CONFIGURATION
|
||||
DJANGO_APPS = (
|
||||
# Default Django apps:
|
||||
'django.contrib.auth',
|
||||
|
@ -66,9 +58,9 @@ class Common(Configuration):
|
|||
'allauth.account', # registration
|
||||
'allauth.socialaccount', # registration
|
||||
)
|
||||
########## END APP CONFIGURATION
|
||||
# END APP CONFIGURATION
|
||||
|
||||
########## MIDDLEWARE CONFIGURATION
|
||||
# MIDDLEWARE CONFIGURATION
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
|
@ -77,35 +69,35 @@ class Common(Configuration):
|
|||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
########## END MIDDLEWARE CONFIGURATION
|
||||
# END MIDDLEWARE CONFIGURATION
|
||||
|
||||
########## DEBUG
|
||||
# DEBUG
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
||||
DEBUG = values.BooleanValue(False)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
########## END DEBUG
|
||||
# END DEBUG
|
||||
|
||||
########## SECRET CONFIGURATION
|
||||
# SECRET CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
||||
# Note: This key only used for development and testing.
|
||||
# In production, this is changed to a values.SecretValue() setting
|
||||
SECRET_KEY = "CHANGEME!!!"
|
||||
########## END SECRET CONFIGURATION
|
||||
# END SECRET CONFIGURATION
|
||||
|
||||
########## FIXTURE CONFIGURATION
|
||||
# FIXTURE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FIXTURE_DIRS
|
||||
FIXTURE_DIRS = (
|
||||
join(BASE_DIR, 'fixtures'),
|
||||
)
|
||||
########## END FIXTURE CONFIGURATION
|
||||
# END FIXTURE CONFIGURATION
|
||||
|
||||
########## EMAIL CONFIGURATION
|
||||
# EMAIL CONFIGURATION
|
||||
EMAIL_BACKEND = values.Value('django.core.mail.backends.smtp.EmailBackend')
|
||||
########## END EMAIL CONFIGURATION
|
||||
# END EMAIL CONFIGURATION
|
||||
|
||||
########## MANAGER CONFIGURATION
|
||||
# MANAGER CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
|
||||
ADMINS = (
|
||||
('{{cookiecutter.author_name}}', '{{cookiecutter.email}}'),
|
||||
|
@ -113,25 +105,25 @@ class Common(Configuration):
|
|||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
|
||||
MANAGERS = ADMINS
|
||||
########## END MANAGER CONFIGURATION
|
||||
# END MANAGER CONFIGURATION
|
||||
|
||||
########## DATABASE CONFIGURATION
|
||||
# DATABASE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
||||
DATABASES = values.DatabaseURLValue('postgres://localhost/{{cookiecutter.repo_name}}')
|
||||
########## END DATABASE CONFIGURATION
|
||||
# END DATABASE CONFIGURATION
|
||||
|
||||
########## CACHING
|
||||
# Do this here because thanks to django-pylibmc-sasl and pylibmc memcacheify is painful to install on windows.
|
||||
# memcacheify is what's used in Production
|
||||
# CACHING
|
||||
# Do this here because thanks to django-pylibmc-sasl and pylibmc
|
||||
# memcacheify (used on heroku) is painful to install on windows.
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
'LOCATION': ''
|
||||
}
|
||||
}
|
||||
########## END CACHING
|
||||
# END CACHING
|
||||
|
||||
########## GENERAL CONFIGURATION
|
||||
# GENERAL CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
|
||||
TIME_ZONE = 'America/Los_Angeles'
|
||||
|
||||
|
@ -149,9 +141,9 @@ class Common(Configuration):
|
|||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-tz
|
||||
USE_TZ = True
|
||||
########## END GENERAL CONFIGURATION
|
||||
# END GENERAL CONFIGURATION
|
||||
|
||||
########## TEMPLATE CONFIGURATION
|
||||
# TEMPLATE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
|
@ -179,9 +171,9 @@ class Common(Configuration):
|
|||
|
||||
# See: http://django-crispy-forms.readthedocs.org/en/latest/install.html#template-packs
|
||||
CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
||||
########## END TEMPLATE CONFIGURATION
|
||||
# END TEMPLATE CONFIGURATION
|
||||
|
||||
########## STATIC FILE CONFIGURATION
|
||||
# STATIC FILE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
|
||||
STATIC_ROOT = join(os.path.dirname(BASE_DIR), 'staticfiles')
|
||||
|
||||
|
@ -198,24 +190,24 @@ class Common(Configuration):
|
|||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
)
|
||||
########## END STATIC FILE CONFIGURATION
|
||||
# END STATIC FILE CONFIGURATION
|
||||
|
||||
########## MEDIA CONFIGURATION
|
||||
# MEDIA CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
|
||||
MEDIA_ROOT = join(BASE_DIR, 'media')
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
|
||||
MEDIA_URL = '/media/'
|
||||
########## END MEDIA CONFIGURATION
|
||||
# END MEDIA CONFIGURATION
|
||||
|
||||
########## URL Configuration
|
||||
ROOT_URLCONF = 'config.urls'
|
||||
# URL Configuration
|
||||
ROOT_URLCONF = 'urls'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
|
||||
WSGI_APPLICATION = 'config.wsgi.application'
|
||||
########## End URL Configuration
|
||||
WSGI_APPLICATION = 'wsgi.application'
|
||||
# End URL Configuration
|
||||
|
||||
########## AUTHENTICATION CONFIGURATION
|
||||
# AUTHENTICATION CONFIGURATION
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
"django.contrib.auth.backends.ModelBackend",
|
||||
"allauth.account.auth_backends.AuthenticationBackend",
|
||||
|
@ -225,20 +217,20 @@ class Common(Configuration):
|
|||
ACCOUNT_AUTHENTICATION_METHOD = "username"
|
||||
ACCOUNT_EMAIL_REQUIRED = True
|
||||
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
||||
########## END AUTHENTICATION CONFIGURATION
|
||||
# END AUTHENTICATION CONFIGURATION
|
||||
|
||||
########## Custom user app defaults
|
||||
# Custom user app defaults
|
||||
# Select the correct user model
|
||||
AUTH_USER_MODEL = "users.User"
|
||||
LOGIN_REDIRECT_URL = "users:redirect"
|
||||
LOGIN_URL = "account_login"
|
||||
########## END Custom user app defaults
|
||||
# END Custom user app defaults
|
||||
|
||||
########## SLUGLIFIER
|
||||
# SLUGLIFIER
|
||||
AUTOSLUG_SLUGIFY_FUNCTION = "slugify.slugify"
|
||||
########## END SLUGLIFIER
|
||||
# END SLUGLIFIER
|
||||
|
||||
########## LOGGING CONFIGURATION
|
||||
# LOGGING CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
|
||||
# A sample logging configuration. The only tangible logging
|
||||
# performed by this configuration is to send an email to
|
||||
|
@ -268,142 +260,6 @@ class Common(Configuration):
|
|||
},
|
||||
}
|
||||
}
|
||||
########## END LOGGING CONFIGURATION
|
||||
# END LOGGING CONFIGURATION
|
||||
|
||||
########## Your common stuff: Below this line define 3rd party libary settings
|
||||
|
||||
|
||||
class Local(Common):
|
||||
|
||||
########## DEBUG
|
||||
DEBUG = values.BooleanValue(True)
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
########## END DEBUG
|
||||
|
||||
########## INSTALLED_APPS
|
||||
INSTALLED_APPS = Common.INSTALLED_APPS
|
||||
########## END INSTALLED_APPS
|
||||
|
||||
########## Mail settings
|
||||
EMAIL_HOST = "localhost"
|
||||
EMAIL_PORT = 1025
|
||||
EMAIL_BACKEND = values.Value('django.core.mail.backends.console.EmailBackend')
|
||||
########## End mail settings
|
||||
|
||||
########## django-debug-toolbar
|
||||
MIDDLEWARE_CLASSES = Common.MIDDLEWARE_CLASSES + ('debug_toolbar.middleware.DebugToolbarMiddleware',)
|
||||
INSTALLED_APPS += ('debug_toolbar',)
|
||||
|
||||
INTERNAL_IPS = ('127.0.0.1',)
|
||||
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
'DISABLE_PANELS': [
|
||||
'debug_toolbar.panels.redirects.RedirectsPanel',
|
||||
],
|
||||
'SHOW_TEMPLATE_CONTEXT': True,
|
||||
}
|
||||
########## end django-debug-toolbar
|
||||
|
||||
########## Your local stuff: Below this line define 3rd party libary settings
|
||||
|
||||
|
||||
class Production(Common):
|
||||
|
||||
########## INSTALLED_APPS
|
||||
INSTALLED_APPS = Common.INSTALLED_APPS
|
||||
########## END INSTALLED_APPS
|
||||
|
||||
########## SECRET KEY
|
||||
SECRET_KEY = values.SecretValue()
|
||||
########## END SECRET KEY
|
||||
|
||||
########## django-secure
|
||||
INSTALLED_APPS += ("djangosecure", )
|
||||
|
||||
# set this to 60 seconds and then to 518400 when you can prove it works
|
||||
SECURE_HSTS_SECONDS = 60
|
||||
SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True)
|
||||
SECURE_FRAME_DENY = values.BooleanValue(True)
|
||||
SECURE_CONTENT_TYPE_NOSNIFF = values.BooleanValue(True)
|
||||
SECURE_BROWSER_XSS_FILTER = values.BooleanValue(True)
|
||||
SESSION_COOKIE_SECURE = values.BooleanValue(False)
|
||||
SESSION_COOKIE_HTTPONLY = values.BooleanValue(True)
|
||||
SECURE_SSL_REDIRECT = values.BooleanValue(True)
|
||||
########## end django-secure
|
||||
|
||||
########## SITE CONFIGURATION
|
||||
# Hosts/domain names that are valid for this site
|
||||
# See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
########## END SITE CONFIGURATION
|
||||
|
||||
INSTALLED_APPS += ("gunicorn", )
|
||||
|
||||
########## STORAGE CONFIGURATION
|
||||
# See: http://django-storages.readthedocs.org/en/latest/index.html
|
||||
INSTALLED_APPS += (
|
||||
'storages',
|
||||
)
|
||||
|
||||
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
|
||||
STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
|
||||
|
||||
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
|
||||
AWS_ACCESS_KEY_ID = values.SecretValue()
|
||||
AWS_SECRET_ACCESS_KEY = values.SecretValue()
|
||||
AWS_STORAGE_BUCKET_NAME = values.SecretValue()
|
||||
AWS_AUTO_CREATE_BUCKET = True
|
||||
AWS_QUERYSTRING_AUTH = False
|
||||
|
||||
# see: https://github.com/antonagestam/collectfast
|
||||
AWS_PRELOAD_METADATA = True
|
||||
INSTALLED_APPS += ("collectfast", )
|
||||
|
||||
# AWS cache settings, don't change unless you know what you're doing:
|
||||
AWS_EXPIREY = 60 * 60 * 24 * 7
|
||||
AWS_HEADERS = {
|
||||
'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIREY,
|
||||
AWS_EXPIREY)
|
||||
}
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
||||
STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME
|
||||
########## END STORAGE CONFIGURATION
|
||||
|
||||
########## EMAIL
|
||||
DEFAULT_FROM_EMAIL = values.Value(
|
||||
'{{cookiecutter.project_name}} <noreply@{{cookiecutter.domain_name}}>')
|
||||
EMAIL_HOST = values.Value('smtp.sendgrid.com')
|
||||
EMAIL_HOST_PASSWORD = values.SecretValue(environ_prefix="", environ_name="SENDGRID_PASSWORD")
|
||||
EMAIL_HOST_USER = values.SecretValue(environ_prefix="", environ_name="SENDGRID_USERNAME")
|
||||
EMAIL_PORT = values.IntegerValue(587, environ_prefix="", environ_name="EMAIL_PORT")
|
||||
EMAIL_SUBJECT_PREFIX = values.Value('[{{cookiecutter.project_name}}] ', environ_name="EMAIL_SUBJECT_PREFIX")
|
||||
EMAIL_USE_TLS = True
|
||||
SERVER_EMAIL = EMAIL_HOST_USER
|
||||
########## END EMAIL
|
||||
|
||||
########## TEMPLATE CONFIGURATION
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
|
||||
TEMPLATE_LOADERS = (
|
||||
('django.template.loaders.cached.Loader', (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
)),
|
||||
)
|
||||
########## END TEMPLATE CONFIGURATION
|
||||
|
||||
########## CACHING
|
||||
# Only do this here because thanks to django-pylibmc-sasl and pylibmc memcacheify is painful to install on windows.
|
||||
try:
|
||||
# See: https://github.com/rdegges/django-heroku-memcacheify
|
||||
from memcacheify import memcacheify
|
||||
CACHES = memcacheify()
|
||||
except ImportError:
|
||||
CACHES = values.CacheURLValue(default="memcached://127.0.0.1:11211")
|
||||
########## END CACHING
|
||||
|
||||
########## Your production stuff: Below this line define 3rd party libary settings
|
||||
|
||||
|
||||
# Generated on {{cookiecutter.now}}
|
||||
# Your common stuff: Below this line define 3rd party libary settings
|
|
@ -0,0 +1,44 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Local Configurations
|
||||
|
||||
- Runs in Debug mode
|
||||
- Uses console backend for emails
|
||||
- Use Django Debug Toolbar
|
||||
'''
|
||||
from configurations import values
|
||||
from .common import Common
|
||||
|
||||
|
||||
class Local(Common):
|
||||
|
||||
# DEBUG
|
||||
DEBUG = values.BooleanValue(True)
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
# END DEBUG
|
||||
|
||||
# INSTALLED_APPS
|
||||
INSTALLED_APPS = Common.INSTALLED_APPS
|
||||
# END INSTALLED_APPS
|
||||
|
||||
# Mail settings
|
||||
EMAIL_HOST = "localhost"
|
||||
EMAIL_PORT = 1025
|
||||
EMAIL_BACKEND = values.Value('django.core.mail.backends.console.EmailBackend')
|
||||
# End mail settings
|
||||
|
||||
# django-debug-toolbar
|
||||
MIDDLEWARE_CLASSES = Common.MIDDLEWARE_CLASSES + ('debug_toolbar.middleware.DebugToolbarMiddleware',)
|
||||
INSTALLED_APPS += ('debug_toolbar',)
|
||||
|
||||
INTERNAL_IPS = ('127.0.0.1',)
|
||||
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
'DISABLE_PANELS': [
|
||||
'debug_toolbar.panels.redirects.RedirectsPanel',
|
||||
],
|
||||
'SHOW_TEMPLATE_CONTEXT': True,
|
||||
}
|
||||
# end django-debug-toolbar
|
||||
|
||||
# Your local stuff: Below this line define 3rd party libary settings
|
|
@ -0,0 +1,118 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Production Configurations
|
||||
|
||||
- Use djangosecure
|
||||
- Use Amazon's S3 for storing static files and uploaded media
|
||||
- Use sendgird to sendemails
|
||||
- Use MEMCACHIER on Heroku
|
||||
'''
|
||||
from configurations import values
|
||||
|
||||
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
|
||||
try:
|
||||
from S3 import CallingFormat
|
||||
AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN
|
||||
except ImportError:
|
||||
# TODO: Fix this where even if in Dev this class is called.
|
||||
pass
|
||||
|
||||
from .common import Common
|
||||
|
||||
|
||||
class Production(Common):
|
||||
|
||||
# INSTALLED_APPS
|
||||
INSTALLED_APPS = Common.INSTALLED_APPS
|
||||
# END INSTALLED_APPS
|
||||
|
||||
# SECRET KEY
|
||||
SECRET_KEY = values.SecretValue()
|
||||
# END SECRET KEY
|
||||
|
||||
# django-secure
|
||||
INSTALLED_APPS += ("djangosecure", )
|
||||
|
||||
# set this to 60 seconds and then to 518400 when you can prove it works
|
||||
SECURE_HSTS_SECONDS = 60
|
||||
SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True)
|
||||
SECURE_FRAME_DENY = values.BooleanValue(True)
|
||||
SECURE_CONTENT_TYPE_NOSNIFF = values.BooleanValue(True)
|
||||
SECURE_BROWSER_XSS_FILTER = values.BooleanValue(True)
|
||||
SESSION_COOKIE_SECURE = values.BooleanValue(False)
|
||||
SESSION_COOKIE_HTTPONLY = values.BooleanValue(True)
|
||||
SECURE_SSL_REDIRECT = values.BooleanValue(True)
|
||||
# end django-secure
|
||||
|
||||
# SITE CONFIGURATION
|
||||
# Hosts/domain names that are valid for this site
|
||||
# See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
# END SITE CONFIGURATION
|
||||
|
||||
INSTALLED_APPS += ("gunicorn", )
|
||||
|
||||
# STORAGE CONFIGURATION
|
||||
# See: http://django-storages.readthedocs.org/en/latest/index.html
|
||||
INSTALLED_APPS += (
|
||||
'storages',
|
||||
)
|
||||
|
||||
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
|
||||
STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
|
||||
|
||||
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
|
||||
AWS_ACCESS_KEY_ID = values.SecretValue()
|
||||
AWS_SECRET_ACCESS_KEY = values.SecretValue()
|
||||
AWS_STORAGE_BUCKET_NAME = values.SecretValue()
|
||||
AWS_AUTO_CREATE_BUCKET = True
|
||||
AWS_QUERYSTRING_AUTH = False
|
||||
|
||||
# see: https://github.com/antonagestam/collectfast
|
||||
AWS_PRELOAD_METADATA = True
|
||||
INSTALLED_APPS += ("collectfast", )
|
||||
|
||||
# AWS cache settings, don't change unless you know what you're doing:
|
||||
AWS_EXPIREY = 60 * 60 * 24 * 7
|
||||
AWS_HEADERS = {
|
||||
'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (
|
||||
AWS_EXPIREY, AWS_EXPIREY)
|
||||
}
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
||||
STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME
|
||||
# END STORAGE CONFIGURATION
|
||||
|
||||
# EMAIL
|
||||
DEFAULT_FROM_EMAIL = values.Value('{{cookiecutter.project_name}} <noreply@{{cookiecutter.domain_name}}>')
|
||||
EMAIL_HOST = values.Value('smtp.sendgrid.com')
|
||||
EMAIL_HOST_PASSWORD = values.SecretValue(environ_prefix="", environ_name="SENDGRID_PASSWORD")
|
||||
EMAIL_HOST_USER = values.SecretValue(environ_prefix="", environ_name="SENDGRID_USERNAME")
|
||||
EMAIL_PORT = values.IntegerValue(587, environ_prefix="", environ_name="EMAIL_PORT")
|
||||
EMAIL_SUBJECT_PREFIX = values.Value('[{{cookiecutter.project_name}}] ', environ_name="EMAIL_SUBJECT_PREFIX")
|
||||
EMAIL_USE_TLS = True
|
||||
SERVER_EMAIL = EMAIL_HOST_USER
|
||||
# END EMAIL
|
||||
|
||||
# TEMPLATE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
|
||||
TEMPLATE_LOADERS = (
|
||||
('django.template.loaders.cached.Loader', (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
)),
|
||||
)
|
||||
# END TEMPLATE CONFIGURATION
|
||||
|
||||
# CACHING
|
||||
# Only do this here because thanks to django-pylibmc-sasl and pylibmc
|
||||
# memcacheify is painful to install on windows.
|
||||
try:
|
||||
# See: https://github.com/rdegges/django-heroku-memcacheify
|
||||
from memcacheify import memcacheify
|
||||
CACHES = memcacheify()
|
||||
except ImportError:
|
||||
CACHES = values.CacheURLValue(default="memcached://127.0.0.1:11211")
|
||||
# END CACHING
|
||||
|
||||
# Your production stuff: Below this line define 3rd party libary settings
|
|
@ -3,7 +3,7 @@ import os
|
|||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config")
|
||||
os.environ.setdefault("DJANGO_CONFIGURATION", "Local")
|
||||
|
||||
from configurations.management import execute_from_command_line
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
|
@ -19,7 +19,7 @@ import os
|
|||
# if running multiple sites in the same mod_wsgi process. To fix this, use
|
||||
# mod_wsgi daemon mode with each site in its own daemon process, or use
|
||||
# os.environ["DJANGO_SETTINGS_MODULE"] = "{{ repo_name }}.settings"
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config")
|
||||
os.environ.setdefault("DJANGO_CONFIGURATION", "Production")
|
||||
|
||||
# This application object is used by any WSGI server configured to use this
|
Loading…
Reference in New Issue
Block a user