115 lines
3.3 KiB
Python
115 lines
3.3 KiB
Python
import os
|
|
import json
|
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
with open(os.path.join(BASE_DIR, 'secrets.json')) as f:
|
|
secrets = json.load(f)
|
|
|
|
TIME_ZONE = 'America/New_York'
|
|
|
|
SECRET_KEY = secrets.get('SECRET_KEY', "default_secret")
|
|
|
|
DEBUG = secrets.get('DEBUG', True)
|
|
SITE_ID = 1
|
|
|
|
ROOT_URLCONF = 'config.urls'
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': os.path.join(BASE_DIR, 'brewery.sqlite')
|
|
}
|
|
}
|
|
|
|
ALLOWED_HOSTS = secrets.get('ALLOWED_HOSTS', ['localhost', '127.0.0.1'])
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.admindocs',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.sites',
|
|
'django.contrib.flatpages',
|
|
'fontawesomefree',
|
|
'mathfilters',
|
|
'yeast.apps.YeastLabConfig',
|
|
'beer.apps.BeerConfig',
|
|
'equipment.apps.EquipmentConfig',
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.contrib.admindocs.middleware.XViewMiddleware',
|
|
# 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
|
# "django.contrib.flatpages.middleware.FlatpageFallbackMiddleware",
|
|
# 'django.contrib.messages.middleware.MessageMiddleware',
|
|
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
# 'django.middleware.security.SecurityMiddleware',
|
|
]
|
|
|
|
MEDIA_ROOT = '/tmp/media/'
|
|
MEDIA_URL = '/media/'
|
|
|
|
STATIC_ROOT = secrets.get('STATIC_ROOT', os.path.join(BASE_DIR, 'sitestatic'))
|
|
STATIC_URL = '/static/'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [
|
|
os.path.join(BASE_DIR, 'templates'),
|
|
],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
# Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
|
|
# list if you haven't customized them:
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.i18n',
|
|
'django.template.context_processors.media',
|
|
'django.template.context_processors.static',
|
|
'django.template.context_processors.tz',
|
|
'django.template.context_processors.request',
|
|
'django.contrib.messages.context_processors.messages',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
|
|
|
LOGIN_REDIRECT_URL = 'home'
|
|
LOGIN_URL = 'login'
|
|
LOGOUT_REDIRECT_URL = 'home'
|
|
|
|
LOGGING = {
|
|
"version": 1,
|
|
"disable_existing_loggers": False,
|
|
"handlers": {
|
|
"console": {"class": "logging.StreamHandler"},
|
|
},
|
|
"loggers": {
|
|
"django": {
|
|
"handlers": ["console"],
|
|
"level": "INFO",
|
|
},
|
|
}
|
|
}
|
|
|
|
if DEBUG:
|
|
# make all loggers use the console.
|
|
for logger in LOGGING['loggers']:
|
|
LOGGING['loggers'][logger]['handlers'] = ['console']
|