mirror of
https://github.com/nikdoof/vapemap.git
synced 2025-12-14 14:52:16 +00:00
Update to segmented config files.
This commit is contained in:
1
app/vapemap/conf/__init__.py
Normal file
1
app/vapemap/conf/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
158
app/vapemap/conf/base.py
Normal file
158
app/vapemap/conf/base.py
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import dj_database_url
|
||||||
|
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
|
||||||
|
|
||||||
|
DEBUG = True
|
||||||
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
|
||||||
|
ADMINS = (
|
||||||
|
# ('Your Name', 'your_email@example.com'),
|
||||||
|
)
|
||||||
|
|
||||||
|
MANAGERS = ADMINS
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': dj_database_url.config(default='sqlite:///%s' % os.path.join(os.path.dirname(__file__), '..', '..', 'db.sqlite3')),
|
||||||
|
}
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = [
|
||||||
|
'vapemap.herokuapp.com',
|
||||||
|
'www.vapemap.co.uk',
|
||||||
|
'www.vapourhunter.co.uk',
|
||||||
|
'www.vapourhunter.com',
|
||||||
|
]
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
SITE_ID = 1
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
USE_L10N = True
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
MEDIA_ROOT = os.path.join(os.path.dirname(__file__), '..', '..', 'media')
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
|
||||||
|
STATIC_ROOT = os.path.join(os.path.dirname(__file__), '..', '..', 'static')
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
|
STATICFILES_DIRS = [
|
||||||
|
os.path.join(os.path.dirname(__file__), 'static'),
|
||||||
|
]
|
||||||
|
|
||||||
|
STATICFILES_FINDERS = (
|
||||||
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||||
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||||
|
)
|
||||||
|
|
||||||
|
TEMPLATE_LOADERS = (
|
||||||
|
'django.template.loaders.filesystem.Loader',
|
||||||
|
'django.template.loaders.app_directories.Loader',
|
||||||
|
)
|
||||||
|
|
||||||
|
TEMPLATE_DIRS = [
|
||||||
|
os.path.join(os.path.dirname(__file__), '..', 'templates'),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
SECRET_KEY = '4-jz1w*@m**o4dk6!%e22xq3aj!r^9+y(s+_8)v-+)v4fz1lsa'
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.sites',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.flatpages',
|
||||||
|
'gunicorn',
|
||||||
|
'raven.contrib.django.raven_compat',
|
||||||
|
'south',
|
||||||
|
'waffle',
|
||||||
|
'storages',
|
||||||
|
'markdown_deux',
|
||||||
|
'epiceditor',
|
||||||
|
'bootstrapform',
|
||||||
|
'registration',
|
||||||
|
'haystack',
|
||||||
|
'stores',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE_CLASSES = [
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
||||||
|
'waffle.middleware.WaffleMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
TEMPLATE_CONTEXT_PROCESSORS += (
|
||||||
|
'django.core.context_processors.request',
|
||||||
|
'stores.context_processors.site',
|
||||||
|
'stores.context_processors.pending_admin',
|
||||||
|
)
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'vapemap.urls'
|
||||||
|
WSGI_APPLICATION = 'vapemap.wsgi.application'
|
||||||
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||||
|
|
||||||
|
LOGGING = {
|
||||||
|
'version': 1,
|
||||||
|
'disable_existing_loggers': False,
|
||||||
|
'root': {
|
||||||
|
'level': 'WARNING',
|
||||||
|
'handlers': ['sentry', 'console'],
|
||||||
|
},
|
||||||
|
'filters': {
|
||||||
|
'require_debug_false': {
|
||||||
|
'()': 'django.utils.log.RequireDebugFalse'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'formatters': {
|
||||||
|
'verbose': {
|
||||||
|
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'handlers': {
|
||||||
|
'sentry': {
|
||||||
|
'level': 'ERROR',
|
||||||
|
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
|
||||||
|
},
|
||||||
|
'console': {
|
||||||
|
'level': 'INFO',
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
'stream': sys.stdout,
|
||||||
|
'formatter': 'verbose',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'loggers': {
|
||||||
|
'django.db.backends': {
|
||||||
|
'level': 'ERROR',
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
'raven': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
'sentry.errors': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'handlers': ['console'],
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HAYSTACK_CONNECTIONS = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
|
||||||
|
'URL': os.environ.get('FOUNDELASTICSEARCH_URL', 'http://127.0.0.1:9200/'),
|
||||||
|
'INDEX_NAME': 'vapemap-haystack',
|
||||||
|
},
|
||||||
|
}
|
||||||
17
app/vapemap/conf/development.py
Normal file
17
app/vapemap/conf/development.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from .base import *
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLED_APPS.append('debug_toolbar')
|
||||||
|
MIDDLEWARE_CLASSES.append('debug_toolbar.middleware.DebugToolbarMiddleware')
|
||||||
|
|
||||||
|
def custom_show_toolbar(request):
|
||||||
|
return True
|
||||||
|
|
||||||
|
DEBUG_TOOLBAR_CONFIG = {
|
||||||
|
'INTERCEPT_REDIRECTS': False,
|
||||||
|
'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
|
||||||
|
'EXTRA_SIGNALS': [],
|
||||||
|
'HIDE_DJANGO_SQL': True,
|
||||||
|
'TAG': 'div',
|
||||||
|
'ENABLE_STACKTRACES' : True,
|
||||||
|
}
|
||||||
16
app/vapemap/conf/production.py
Normal file
16
app/vapemap/conf/production.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
from .base import *
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
|
||||||
|
AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY']
|
||||||
|
AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME', 'vapemap-static')
|
||||||
|
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
|
||||||
|
S3_URL = 'http://%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME
|
||||||
|
STATIC_URL = S3_URL
|
||||||
|
|
||||||
|
EMAIL_HOST = 'smtp.sendgrid.net'
|
||||||
|
EMAIL_HOST_USER = os.environ['SENDGRID_USERNAME']
|
||||||
|
EMAIL_HOST_PASSWORD = os.environ['SENDGRID_PASSWORD']
|
||||||
|
EMAIL_PORT = 587
|
||||||
|
EMAIL_USE_TLS = True
|
||||||
@@ -1,188 +1 @@
|
|||||||
import os
|
from .conf.development import *
|
||||||
import sys
|
|
||||||
import dj_database_url
|
|
||||||
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
|
|
||||||
|
|
||||||
DEBUG = bool(os.environ.get('DJANGO_DEBUG', ''))
|
|
||||||
TEMPLATE_DEBUG = DEBUG
|
|
||||||
|
|
||||||
ADMINS = (
|
|
||||||
# ('Your Name', 'your_email@example.com'),
|
|
||||||
)
|
|
||||||
|
|
||||||
MANAGERS = ADMINS
|
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': dj_database_url.config(default='sqlite:///%s' % os.path.join(os.path.dirname(__file__), '..', '..', 'db.sqlite3')),
|
|
||||||
}
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = [
|
|
||||||
'vapemap.herokuapp.com',
|
|
||||||
'www.vapemap.co.uk',
|
|
||||||
'www.vapourhunter.co.uk',
|
|
||||||
'www.vapourhunter.com',
|
|
||||||
]
|
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
|
||||||
LANGUAGE_CODE = 'en-us'
|
|
||||||
SITE_ID = 1
|
|
||||||
|
|
||||||
USE_I18N = True
|
|
||||||
USE_L10N = True
|
|
||||||
USE_TZ = True
|
|
||||||
|
|
||||||
MEDIA_ROOT = os.path.join(os.path.dirname(__file__), '..', 'media')
|
|
||||||
MEDIA_URL = '/media/'
|
|
||||||
|
|
||||||
STATIC_ROOT = os.path.join(os.path.dirname(__file__), '..', 'static')
|
|
||||||
STATIC_URL = '/static/'
|
|
||||||
|
|
||||||
STATICFILES_DIRS = [
|
|
||||||
os.path.join(os.path.dirname(__file__), 'static'),
|
|
||||||
]
|
|
||||||
|
|
||||||
STATICFILES_FINDERS = (
|
|
||||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
||||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
||||||
)
|
|
||||||
|
|
||||||
TEMPLATE_LOADERS = (
|
|
||||||
'django.template.loaders.filesystem.Loader',
|
|
||||||
'django.template.loaders.app_directories.Loader',
|
|
||||||
)
|
|
||||||
|
|
||||||
TEMPLATE_DIRS = [
|
|
||||||
os.path.join(os.path.dirname(__file__), 'templates'),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
SECRET_KEY = '4-jz1w*@m**o4dk6!%e22xq3aj!r^9+y(s+_8)v-+)v4fz1lsa'
|
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
|
||||||
'django.contrib.auth',
|
|
||||||
'django.contrib.contenttypes',
|
|
||||||
'django.contrib.sessions',
|
|
||||||
'django.contrib.sites',
|
|
||||||
'django.contrib.messages',
|
|
||||||
'django.contrib.staticfiles',
|
|
||||||
'django.contrib.admin',
|
|
||||||
'django.contrib.flatpages',
|
|
||||||
'gunicorn',
|
|
||||||
'raven.contrib.django.raven_compat',
|
|
||||||
'south',
|
|
||||||
'waffle',
|
|
||||||
'storages',
|
|
||||||
'markdown_deux',
|
|
||||||
'epiceditor',
|
|
||||||
'bootstrapform',
|
|
||||||
'registration',
|
|
||||||
'haystack',
|
|
||||||
'stores',
|
|
||||||
]
|
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = [
|
|
||||||
'django.middleware.common.CommonMiddleware',
|
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
||||||
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
|
||||||
'waffle.middleware.WaffleMiddleware',
|
|
||||||
]
|
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS += (
|
|
||||||
'django.core.context_processors.request',
|
|
||||||
'stores.context_processors.site',
|
|
||||||
'stores.context_processors.pending_admin',
|
|
||||||
)
|
|
||||||
|
|
||||||
if DEBUG:
|
|
||||||
INSTALLED_APPS.append('debug_toolbar')
|
|
||||||
MIDDLEWARE_CLASSES.append('debug_toolbar.middleware.DebugToolbarMiddleware')
|
|
||||||
|
|
||||||
def custom_show_toolbar(request):
|
|
||||||
return True # Always show toolbar, for example purposes only.
|
|
||||||
|
|
||||||
DEBUG_TOOLBAR_CONFIG = {
|
|
||||||
'INTERCEPT_REDIRECTS': False,
|
|
||||||
'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
|
|
||||||
'EXTRA_SIGNALS': [],
|
|
||||||
'HIDE_DJANGO_SQL': True,
|
|
||||||
'TAG': 'div',
|
|
||||||
'ENABLE_STACKTRACES' : True,
|
|
||||||
}
|
|
||||||
|
|
||||||
ROOT_URLCONF = 'vapemap.urls'
|
|
||||||
WSGI_APPLICATION = 'vapemap.wsgi.application'
|
|
||||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|
||||||
|
|
||||||
LOGGING = {
|
|
||||||
'version': 1,
|
|
||||||
'disable_existing_loggers': False,
|
|
||||||
'root': {
|
|
||||||
'level': 'WARNING',
|
|
||||||
'handlers': ['sentry', 'console'],
|
|
||||||
},
|
|
||||||
'filters': {
|
|
||||||
'require_debug_false': {
|
|
||||||
'()': 'django.utils.log.RequireDebugFalse'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'formatters': {
|
|
||||||
'verbose': {
|
|
||||||
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'handlers': {
|
|
||||||
'sentry': {
|
|
||||||
'level': 'ERROR',
|
|
||||||
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
|
|
||||||
},
|
|
||||||
'console': {
|
|
||||||
'level': 'INFO',
|
|
||||||
'class': 'logging.StreamHandler',
|
|
||||||
'stream': sys.stdout,
|
|
||||||
'formatter': 'verbose',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'loggers': {
|
|
||||||
'django.db.backends': {
|
|
||||||
'level': 'ERROR',
|
|
||||||
'handlers': ['console'],
|
|
||||||
'propagate': False,
|
|
||||||
},
|
|
||||||
'raven': {
|
|
||||||
'level': 'DEBUG',
|
|
||||||
'handlers': ['console'],
|
|
||||||
'propagate': False,
|
|
||||||
},
|
|
||||||
'sentry.errors': {
|
|
||||||
'level': 'DEBUG',
|
|
||||||
'handlers': ['console'],
|
|
||||||
'propagate': False,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HAYSTACK_CONNECTIONS = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
|
|
||||||
'URL': os.environ.get('FOUNDELASTICSEARCH_URL', 'http://127.0.0.1:9200/'),
|
|
||||||
'INDEX_NAME': 'vapemap-haystack',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if not DEBUG:
|
|
||||||
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
|
|
||||||
AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY']
|
|
||||||
AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME', 'vapemap-static')
|
|
||||||
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
|
|
||||||
S3_URL = 'http://%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME
|
|
||||||
STATIC_URL = S3_URL
|
|
||||||
|
|
||||||
EMAIL_HOST = 'smtp.sendgrid.net'
|
|
||||||
EMAIL_HOST_USER = os.environ['SENDGRID_USERNAME']
|
|
||||||
EMAIL_HOST_PASSWORD = os.environ['SENDGRID_PASSWORD']
|
|
||||||
EMAIL_PORT = 587
|
|
||||||
EMAIL_USE_TLS = True
|
|
||||||
Reference in New Issue
Block a user