mybuddy/babybuddy/settings/base.py

161 lines
3.7 KiB
Python
Raw Normal View History

2017-08-11 18:32:02 +00:00
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(
os.path.dirname(
os.path.dirname(
os.path.abspath(__file__)
)
)
)
2017-08-11 18:32:02 +00:00
2017-10-23 13:49:09 +00:00
# SECURITY WARNING: set this to your domain name in production!
ALLOWED_HOSTS = ['*']
# Applications
# https://docs.djangoproject.com/en/1.11/ref/applications/
2017-08-11 18:32:02 +00:00
INSTALLED_APPS = [
2017-08-13 14:48:16 +00:00
'api',
2017-10-22 18:00:42 +00:00
'babybuddy',
2017-08-13 14:48:16 +00:00
'core',
2017-08-18 13:02:31 +00:00
'dashboard',
2017-08-21 23:21:08 +00:00
'reports',
2017-08-13 14:48:16 +00:00
'django_filters',
2017-08-13 14:48:16 +00:00
'rest_framework',
2017-08-15 20:50:09 +00:00
'widget_tweaks',
'easy_thumbnails',
2017-08-13 14:48:16 +00:00
2017-08-11 18:32:02 +00:00
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
# Middleware
# https://docs.djangoproject.com/en/1.11/ref/middleware/
2017-08-11 18:32:02 +00:00
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
2017-08-11 18:32:02 +00:00
'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',
]
# URL dispatcher
# https://docs.djangoproject.com/en/1.11/topics/http/urls/
2017-10-22 18:00:42 +00:00
ROOT_URLCONF = 'babybuddy.urls'
2017-08-11 18:32:02 +00:00
# Templates
# https://docs.djangoproject.com/en/1.11/ref/templates/upgrading/#the-templates-settings
2017-08-11 18:32:02 +00:00
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
# WGSI
# https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
2017-08-11 18:32:02 +00:00
2017-10-22 18:00:42 +00:00
WSGI_APPLICATION = 'babybuddy.wsgi.application'
2017-08-11 18:32:02 +00:00
# Authentication
# https://docs.djangoproject.com/en/1.11/topics/auth/default/
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/login/'
LOGOUT_REDIRECT_URL = '/login/'
2017-08-11 18:32:02 +00:00
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'America/New_York'
2017-08-11 18:32:02 +00:00
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]
2017-08-11 18:32:02 +00:00
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
WHITENOISE_ROOT = os.path.join(BASE_DIR, 'static', 'root')
# Django Rest Framework
# http://www.django-rest-framework.org/#
REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': [
'django_filters.rest_framework.DjangoFilterBackend',
],
'DEFAULT_PERMISSION_CLASSES': [
2017-10-22 18:00:42 +00:00
'api.permissions.BabyBuddyDjangoModelPermissions'
],
'DEFAULT_RENDERER_CLASSES': [
'rest_framework.renderers.JSONRenderer',
],
'DEFAULT_PAGINATION_CLASS':
'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 100
}
# Baby Buddy configuration
BABY_BUDDY = {
# A sleep entry with a start time between NAP_START_MIN and NAP_START_MAX
# (in the current TZ) will be categorized as a nap. Use the format %H:%M.
'NAP_START_MIN': '06:00',
'NAP_START_MAX': '18:00'
}