mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 17:47:08 +03:00
Add django-configurations
This commit is contained in:
parent
a2070558c9
commit
cee802c859
|
@ -4,6 +4,6 @@
|
|||
"author_name": "Your Name",
|
||||
"email": "Your email",
|
||||
"description": "A short description of the project.",
|
||||
"year": "Current year",
|
||||
"domain_name": "Domain name"
|
||||
"year": "2013",
|
||||
"domain_name": "example.com"
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ Deployment
|
|||
* heroku addons:add pgbackups
|
||||
* heroku addons:add sendgrid:starter
|
||||
* heroku pg:promote HEROKU_POSTGRESQL_COLOR
|
||||
* heroku config:add AWS_ACCESS_KEY_ID=YOUR_ID
|
||||
* heroku config:add AWS_SECRET_ACCESS_KEY=YOUR_KEY
|
||||
* heroku config:add AWS_STORAGE_BUCKET_NAME=BUCKET
|
||||
* heroku config:add DJANGO_AWS_ACCESS_KEY_ID=YOUR_ID
|
||||
* heroku config:add DJANGO_AWS_SECRET_ACCESS_KEY=YOUR_KEY
|
||||
* heroku config:add DJANGO_AWS_STORAGE_BUCKET_NAME=BUCKET
|
||||
* git push heroku master
|
||||
* heroku run python {{cookiecutter.repo_name}}/manage.py syncdb --noinput --settings=config.settings
|
||||
* heroku run python {{cookiecutter.repo_name}}/manage.py migrate --settings=config.settings
|
||||
|
|
|
@ -1,17 +1,25 @@
|
|||
# Bleeding edge Django
|
||||
https://github.com/django/django/archive/1.6b1.tar.gz
|
||||
|
||||
# Views, models, forms, and images fundamentals
|
||||
django-braces==1.2.2
|
||||
django-model-utils==1.4.0
|
||||
django-floppyforms==1.1
|
||||
Pillow==2.1.0
|
||||
# Configuration
|
||||
dj-database-url==0.2.2
|
||||
django-configurations==0.5.1
|
||||
django-secure==1.0
|
||||
|
||||
# Forms
|
||||
django-braces==1.2.2
|
||||
django-crispy-forms==1.4.0
|
||||
django-floppyforms==1.1
|
||||
|
||||
# Models
|
||||
django-model-utils==1.5.0
|
||||
|
||||
# images
|
||||
Pillow==2.1.0
|
||||
|
||||
# For user registration, either via email or social
|
||||
# Well-built with regular release cycles!
|
||||
django-allauth==0.12.0
|
||||
django-allauth==0.13.0
|
||||
|
||||
# For the persistance stores
|
||||
psycopg2==2.5
|
||||
|
@ -30,8 +38,4 @@ https://bitbucket.org/andrewgodwin/south/get/59f6bae8b1a501ca14a5f23f8b11c44c42f
|
|||
git+git://github.com/jezdez/django-avatar@6393d25166a6c2d2df0bd28e19f161fac2bb1166
|
||||
|
||||
|
||||
# django-crispy-forms with support for Bootstrap 3
|
||||
django-crispy-forms==1.4.0
|
||||
|
||||
|
||||
# Your custom requirements go here
|
||||
|
|
|
@ -12,121 +12,11 @@ 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
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
########## DEBUG CONFIGURATION
|
||||
if os.environ.get("DATABASE_URL", None):
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
||||
DEBUG = False
|
||||
else:
|
||||
DEBUG = True
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
########## END DEBUG CONFIGURATION
|
||||
|
||||
|
||||
########## SECRET CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
||||
# Note: This key only used for development and testing.
|
||||
SECRET_KEY = "CHANGEME!!!"
|
||||
########## END SECRET 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
|
||||
|
||||
|
||||
########## MANAGER CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
|
||||
ADMINS = (
|
||||
('{{cookiecutter.author_name}}', '{{cookiecutter.email}}'),
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
|
||||
MANAGERS = ADMINS
|
||||
########## END MANAGER CONFIGURATION
|
||||
|
||||
|
||||
########## DATABASE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
||||
import dj_database_url
|
||||
DATABASES = {'default': dj_database_url.config()}
|
||||
if DATABASES == {'default': {}}:
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': "{{cookiecutter.repo_name}}",
|
||||
}
|
||||
}
|
||||
########## END DATABASE CONFIGURATION
|
||||
|
||||
|
||||
########## GENERAL CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
|
||||
TIME_ZONE = 'America/Los_Angeles'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#language-code
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id
|
||||
SITE_ID = 1
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
|
||||
USE_I18N = True
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n
|
||||
USE_L10N = True
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-tz
|
||||
USE_TZ = True
|
||||
########## END GENERAL 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
|
||||
|
||||
########## MIDDLEWARE CONFIGURATION
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
########## END MIDDLEWARE CONFIGURATION
|
||||
|
||||
|
||||
########## STATIC FILE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
|
||||
STATIC_ROOT = 'staticfiles'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
|
||||
STATICFILES_DIRS = (
|
||||
join(BASE_DIR, 'static'),
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
)
|
||||
########## END STATIC FILE CONFIGURATION
|
||||
from configurations import Configuration, values
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
########## APP CONFIGURATION
|
||||
DJANGO_APPS = (
|
||||
|
@ -168,17 +58,263 @@ INSTALLED_APPS += (
|
|||
)
|
||||
########## END APP CONFIGURATION
|
||||
|
||||
########## MIDDLEWARE CONFIGURATION
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
########## END MIDDLEWARE CONFIGURATION
|
||||
|
||||
########## URL Configuration
|
||||
ROOT_URLCONF = 'config.urls'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
|
||||
WSGI_APPLICATION = 'config.wsgi.application'
|
||||
########## End URL Configuration
|
||||
class Common(Configuration):
|
||||
|
||||
########## django-secure
|
||||
SECURE = False
|
||||
if SECURE:
|
||||
########## INSTALLED_APPS
|
||||
INSTALLED_APPS = INSTALLED_APPS
|
||||
########## END INSTALLED_APPS
|
||||
|
||||
########## MIDDLEWARE CONFIGURATION
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES
|
||||
########## END MIDDLEWARE CONFIGURATION
|
||||
|
||||
########## DEBUG
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
||||
DEBUG = values.BooleanValue(True)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
########## END DEBUG
|
||||
|
||||
########## 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
|
||||
|
||||
########## FIXTURE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FIXTURE_DIRS
|
||||
FIXTURE_DIRS = (
|
||||
join(BASE_DIR, 'fixtures'),
|
||||
)
|
||||
########## END FIXTURE CONFIGURATION
|
||||
|
||||
########## MANAGER CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
|
||||
ADMINS = (
|
||||
('{{cookiecutter.author_name}}', '{{cookiecutter.email}}'),
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
|
||||
MANAGERS = ADMINS
|
||||
########## END MANAGER CONFIGURATION
|
||||
|
||||
########## DATABASE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
||||
|
||||
DATABASES = {'default': dj_database_url.config()}
|
||||
if DATABASES == {'default': {}}:
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': "{{cookiecutter.repo_name}}",
|
||||
}
|
||||
}
|
||||
########## 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
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
'LOCATION': 'unique-snowflake'
|
||||
}
|
||||
}
|
||||
########## END CACHING
|
||||
|
||||
########## GENERAL CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
|
||||
TIME_ZONE = 'America/Los_Angeles'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#language-code
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id
|
||||
SITE_ID = 1
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
|
||||
USE_I18N = True
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n
|
||||
USE_L10N = True
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-tz
|
||||
USE_TZ = True
|
||||
########## END GENERAL CONFIGURATION
|
||||
|
||||
########## TEMPLATE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
"allauth.account.context_processors.account",
|
||||
"allauth.socialaccount.context_processors.socialaccount",
|
||||
'django.core.context_processors.debug',
|
||||
'django.core.context_processors.i18n',
|
||||
'django.core.context_processors.media',
|
||||
'django.core.context_processors.static',
|
||||
'django.core.context_processors.tz',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'django.core.context_processors.request',
|
||||
# Your stuff: custom template context processers go here
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
|
||||
TEMPLATE_DIRS = (
|
||||
join(BASE_DIR, 'templates'),
|
||||
)
|
||||
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
)
|
||||
|
||||
# See: http://django-crispy-forms.readthedocs.org/en/latest/install.html#template-packs
|
||||
CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
||||
########## END TEMPLATE 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
|
||||
|
||||
########## STATIC FILE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
|
||||
STATIC_ROOT = 'staticfiles'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
|
||||
STATICFILES_DIRS = (
|
||||
join(BASE_DIR, 'static'),
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
)
|
||||
########## END STATIC FILE CONFIGURATION
|
||||
|
||||
########## URL Configuration
|
||||
ROOT_URLCONF = 'config.urls'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
|
||||
WSGI_APPLICATION = 'config.wsgi.application'
|
||||
########## End URL Configuration
|
||||
|
||||
########## AUTHENTICATION CONFIGURATION
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
"django.contrib.auth.backends.ModelBackend",
|
||||
"allauth.account.auth_backends.AuthenticationBackend",
|
||||
)
|
||||
|
||||
# Some really nice defaults
|
||||
ACCOUNT_AUTHENTICATION_METHOD = "username"
|
||||
ACCOUNT_EMAIL_REQUIRED = True
|
||||
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
||||
########## END AUTHENTICATION CONFIGURATION
|
||||
|
||||
########## Custom user app defaults
|
||||
# Select the correct user model
|
||||
AUTH_USER_MODEL = "users.User"
|
||||
LOGIN_REDIRECT_URL = "users:redirect"
|
||||
########## END Custom user app defaults
|
||||
|
||||
########## SLUGLIFIER
|
||||
AUTOSLUG_SLUGIFY_FUNCTION = "slugify.slugify"
|
||||
########## END SLUGLIFIER
|
||||
|
||||
########## 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
|
||||
# the site admins on every HTTP 500 error when DEBUG=False.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'filters': {
|
||||
'require_debug_false': {
|
||||
'()': 'django.utils.log.RequireDebugFalse'
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'filters': ['require_debug_false'],
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'level': 'ERROR',
|
||||
'propagate': True,
|
||||
},
|
||||
}
|
||||
}
|
||||
########## END LOGGING CONFIGURATION
|
||||
|
||||
|
||||
########## Your common stuff: Below this line define 3rd party libary settings
|
||||
|
||||
|
||||
class Local(Common):
|
||||
|
||||
########## INSTALLED_APPS
|
||||
INSTALLED_APPS = INSTALLED_APPS
|
||||
########## END INSTALLED_APPS
|
||||
|
||||
########## Mail settings
|
||||
EMAIL_HOST = "localhost"
|
||||
EMAIL_PORT = 1025
|
||||
########## End mail settings
|
||||
|
||||
########## django-debug-toolbar
|
||||
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
|
||||
INSTALLED_APPS += ('debug_toolbar',)
|
||||
|
||||
INTERNAL_IPS = ('127.0.0.1',)
|
||||
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
'INTERCEPT_REDIRECTS': False,
|
||||
'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 = 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
|
||||
|
@ -190,50 +326,7 @@ if SECURE:
|
|||
SESSION_COOKIE_SECURE = True
|
||||
SESSION_COOKIE_HTTPONLY = True
|
||||
SECURE_SSL_REDIRECT = True
|
||||
########## end django-secure
|
||||
|
||||
|
||||
########## AUTHENTICATION CONFIGURATION
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
"django.contrib.auth.backends.ModelBackend",
|
||||
"allauth.account.auth_backends.AuthenticationBackend",
|
||||
)
|
||||
|
||||
# Some really nice defaults
|
||||
ACCOUNT_AUTHENTICATION_METHOD = "username"
|
||||
ACCOUNT_EMAIL_REQUIRED = True
|
||||
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
||||
########## END AUTHENTICATION CONFIGURATION
|
||||
|
||||
|
||||
########## Custom user app defaults
|
||||
# Select the correct user model
|
||||
AUTH_USER_MODEL = "users.User"
|
||||
LOGIN_REDIRECT_URL = "users:redirect"
|
||||
########## END Custom user app defaults
|
||||
|
||||
|
||||
########## SLUGLIFIER
|
||||
AUTOSLUG_SLUGIFY_FUNCTION = "slugify.slugify"
|
||||
########## END SLUGLIFIER
|
||||
|
||||
|
||||
################## PRODUCTION SETTINGS
|
||||
if DEBUG:
|
||||
EMAIL_HOST = "localhost"
|
||||
EMAIL_PORT = 1025
|
||||
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
|
||||
INSTALLED_APPS += ('debug_toolbar',)
|
||||
|
||||
INTERNAL_IPS = ('127.0.0.1',)
|
||||
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
'INTERCEPT_REDIRECTS': False,
|
||||
'SHOW_TEMPLATE_CONTEXT': True,
|
||||
}
|
||||
else:
|
||||
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
########## end django-secure
|
||||
|
||||
########## SITE CONFIGURATION
|
||||
# Hosts/domain names that are valid for this site
|
||||
|
@ -244,8 +337,6 @@ else:
|
|||
INSTALLED_APPS += ("gunicorn", )
|
||||
|
||||
########## STORAGE CONFIGURATION
|
||||
from S3 import CallingFormat
|
||||
from os import environ
|
||||
# See: http://django-storages.readthedocs.org/en/latest/index.html
|
||||
INSTALLED_APPS += (
|
||||
'storages',
|
||||
|
@ -255,12 +346,17 @@ else:
|
|||
STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
|
||||
|
||||
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
|
||||
AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN
|
||||
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
|
||||
|
||||
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
|
||||
AWS_ACCESS_KEY_ID = environ.get('AWS_ACCESS_KEY_ID', '')
|
||||
AWS_SECRET_ACCESS_KEY = environ.get('AWS_SECRET_ACCESS_KEY', '')
|
||||
AWS_STORAGE_BUCKET_NAME = environ.get('AWS_STORAGE_BUCKET_NAME', '')
|
||||
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
|
||||
|
||||
|
@ -276,96 +372,34 @@ else:
|
|||
########## END STORAGE CONFIGURATION
|
||||
|
||||
########## EMAIL
|
||||
DEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL',
|
||||
DEFAULT_FROM_EMAIL = values.Value(
|
||||
'{{cookiecutter.project_name}} <{{cookiecutter.project_name}}-noreply@{{cookiecutter.domain_name}}>')
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
EMAIL_HOST = os.environ.get('EMAIL_HOST', 'smtp.sendgrid.com')
|
||||
EMAIL_HOST_PASSWORD = os.environ.get('SENDGRID_PASSWORD', '')
|
||||
EMAIL_HOST_USER = os.environ.get('SENDGRID_USERNAME', '')
|
||||
EMAIL_PORT = os.environ.get('EMAIL_PORT', 587)
|
||||
EMAIL_SUBJECT_PREFIX = os.environ.get('EMAIL_SUBJECT_PREFIX', '[{{cookiecutter.project_name}}] ')
|
||||
EMAIL_BACKEND = values.Value('django.core.mail.backends.smtp.EmailBackend')
|
||||
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
|
||||
|
||||
########## CACHING
|
||||
from memcacheify import memcacheify
|
||||
CACHES = memcacheify()
|
||||
########## END CACHING
|
||||
|
||||
########## 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',
|
||||
"allauth.account.context_processors.account",
|
||||
"allauth.socialaccount.context_processors.socialaccount",
|
||||
'django.core.context_processors.debug',
|
||||
'django.core.context_processors.i18n',
|
||||
'django.core.context_processors.media',
|
||||
'django.core.context_processors.static',
|
||||
'django.core.context_processors.tz',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'django.core.context_processors.request',
|
||||
# Your stuff: custom template context processers go here
|
||||
)
|
||||
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
|
||||
TEMPLATE_DIRS = (
|
||||
join(BASE_DIR, 'templates'),
|
||||
)
|
||||
|
||||
if DEBUG:
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
)
|
||||
else:
|
||||
# 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',
|
||||
)),
|
||||
)
|
||||
|
||||
# See: http://django-crispy-forms.readthedocs.org/en/latest/install.html#template-packs
|
||||
CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
||||
########## END TEMPLATE CONFIGURATION
|
||||
########## END TEMPLATE CONFIGURATION
|
||||
|
||||
########## CACHING
|
||||
# Only do this here because thanks to django-pylibmc-sasl and pylibmc memcacheify is painful to install on windows.
|
||||
from memcacheify import memcacheify
|
||||
CACHES = memcacheify()
|
||||
########## END CACHING
|
||||
|
||||
########## 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
|
||||
# the site admins on every HTTP 500 error when DEBUG=False.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'filters': {
|
||||
'require_debug_false': {
|
||||
'()': 'django.utils.log.RequireDebugFalse'
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'filters': ['require_debug_false'],
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'level': 'ERROR',
|
||||
'propagate': True,
|
||||
},
|
||||
}
|
||||
}
|
||||
########## END LOGGING CONFIGURATION
|
||||
|
||||
|
||||
########## Your stuff: Below this line define 3rd party libary settings
|
||||
########## Your production stuff: Below this line define 3rd party libary settings
|
||||
|
||||
|
|
|
@ -14,15 +14,20 @@ framework.
|
|||
|
||||
"""
|
||||
import os
|
||||
from os.path import abspath, dirname
|
||||
from sys import path
|
||||
|
||||
SITE_ROOT = dirname(dirname(abspath(__file__)))
|
||||
path.append(SITE_ROOT)
|
||||
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
|
||||
# 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", "{{ cookiecutter.repo_name }}.config.settings")
|
||||
os.environ.setdefault("DJANGO_CONFIGURATION", "Local")
|
||||
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
||||
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
# This application object is used by any WSGI server configured to use this
|
||||
# file. This includes Django's development server, if the WSGI_APPLICATION
|
||||
# setting points here.
|
||||
from configurations.wsgi import get_wsgi_application
|
||||
application = get_wsgi_application()
|
||||
|
||||
# Apply WSGI middleware here.
|
||||
# from helloworld.wsgi import HelloWorldApplication
|
||||
# application = HelloWorldApplication(application)
|
|
@ -4,7 +4,8 @@ import sys
|
|||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
||||
os.environ.setdefault("DJANGO_CONFIGURATION", "Local")
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
from configurations.management import execute_from_command_line
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
|
|
Loading…
Reference in New Issue
Block a user