112 lines
3.1 KiB
Python
112 lines
3.1 KiB
Python
from boto.s3.connection import OrdinaryCallingFormat
|
|
from django.utils import six
|
|
|
|
from .base import * # noqa
|
|
|
|
|
|
SECRET_KEY = env("DJANGO_SECRET_KEY")
|
|
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|
|
|
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['ccdb.info'])
|
|
|
|
INSTALLED_APPS += ("gunicorn", )
|
|
|
|
INSTALLED_APPS += (
|
|
'storages',
|
|
)
|
|
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
|
|
|
|
AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID')
|
|
AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
|
|
AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME')
|
|
AWS_AUTO_CREATE_BUCKET = True
|
|
AWS_QUERYSTRING_AUTH = False
|
|
AWS_S3_CALLING_FORMAT = OrdinaryCallingFormat()
|
|
|
|
AWS_EXPIRY = 60 * 60 * 24 * 7
|
|
|
|
AWS_HEADERS = {
|
|
'Cache-Control': six.b('max-age=%d, s-maxage=%d, must-revalidate' % (
|
|
AWS_EXPIRY, AWS_EXPIRY))
|
|
}
|
|
|
|
MEDIA_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME
|
|
|
|
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
|
|
|
|
ANYMAIL = {
|
|
'MAILGUN_API_KEY': env('DJANGO_MAILGUN_API_KEY')
|
|
'MAILGUN_SENDER_DOMAIN': env('DJANGO_MAILGUN_SERVER_NAME')
|
|
}
|
|
DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL',
|
|
default='CCDB Admin <noreply@ccdb.info>')
|
|
EMAIL_BACKEND = 'anymail.backends.mailgun.EmailBackend'
|
|
EMAIL_SUBJECT_PREFIX = env("DJANGO_EMAIL_SUBJECT_PREFIX", default='[ccdb] ')
|
|
SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL)
|
|
|
|
|
|
TEMPLATES[0]['OPTIONS']['loaders'] = [
|
|
(
|
|
'django.template.loaders.cached.Loader',
|
|
[
|
|
'django.template.loaders.filesystem.Loader',
|
|
'django.template.loaders.app_directories.Loader'
|
|
]
|
|
),
|
|
]
|
|
|
|
DATABASES['default'] = env.db("DATABASE_URL")
|
|
|
|
|
|
LOGGING = {
|
|
'version': 1,
|
|
'disable_existing_loggers': False,
|
|
'filters': {
|
|
'require_debug_false': {
|
|
'()': 'django.utils.log.RequireDebugFalse'
|
|
}
|
|
},
|
|
'formatters': {
|
|
'verbose': {
|
|
'format': '%(levelname)s %(asctime)s %(module)s '
|
|
'%(process)d %(thread)d %(message)s'
|
|
},
|
|
},
|
|
'handlers': {
|
|
'mail_admins': {
|
|
'level': 'ERROR',
|
|
'filters': ['require_debug_false'],
|
|
'class': 'django.utils.log.AdminEmailHandler'
|
|
},
|
|
'console': {
|
|
'level': 'DEBUG',
|
|
'class': 'logging.StreamHandler',
|
|
'formatter': 'verbose',
|
|
},
|
|
},
|
|
'loggers': {
|
|
'django.request': {
|
|
'handlers': ['mail_admins'],
|
|
'level': 'ERROR',
|
|
'propagate': True
|
|
},
|
|
'django.security.DisallowedHost': {
|
|
'level': 'ERROR',
|
|
'handlers': ['console', 'mail_admins'],
|
|
'propagate': True
|
|
}
|
|
}
|
|
}
|
|
|
|
ADMIN_URL = env('DJANGO_ADMIN_URL')
|
|
|
|
CORS_ORIGIN_ALLOW_ALL = False
|
|
CORS_ORIGIN_WHITELIST = env.tuple('CORS_ORIGIN_WHITELIST', None)
|
|
|
|
DJOSER = {
|
|
'SITE_NAME': 'CCDB',
|
|
'DOMAIN': 'https://ccdb.info',
|
|
'PASSWORD_RESET_CONFIRM_URL': 'https://ccdb.info/password-reset?'
|
|
'uid={uid}&token={token}',
|
|
}
|