bornhack-website/src/bornhack/settings.py

134 lines
3.4 KiB
Python
Raw Normal View History

2015-10-03 01:07:05 +00:00
import os
from .environment_settings import *
2015-10-03 01:07:05 +00:00
def local_dir(entry):
return os.path.join(
os.path.dirname(os.path.dirname(__file__)),
entry
)
DJANGO_BASE_PATH = os.path.dirname(os.path.dirname(__file__))
2015-10-03 01:07:05 +00:00
WSGI_APPLICATION = 'bornhack.wsgi.application'
ROOT_URLCONF = 'bornhack.urls'
SITE_ID = 1
2016-11-09 15:02:17 +00:00
ADMINS = (
('bornhack sysadm', 'sysadm@bornhack.org'),
)
2015-10-03 01:07:05 +00:00
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
2016-02-20 22:39:02 +00:00
'profiles',
'camps',
'shop',
2016-05-30 19:36:14 +00:00
'news',
'utils',
2016-07-05 21:43:18 +00:00
'villages',
2016-07-13 19:44:09 +00:00
'program',
'info',
'sponsors',
2017-01-30 11:05:11 +00:00
'ircbot',
2016-02-20 22:39:02 +00:00
'allauth',
'allauth.account',
'bootstrap3',
2015-10-03 01:07:05 +00:00
]
STATIC_URL = '/static/'
STATIC_ROOT = local_dir('static')
STATICFILES_DIRS = [local_dir('static_src')]
2015-10-03 01:07:05 +00:00
LANGUAGE_CODE = 'en-us'
#USE_I18N = True
#USE_L10N = True
2015-10-03 01:07:05 +00:00
USE_TZ = True
SHORT_DATE_FORMAT = 'd/m-Y'
DATE_FORMAT = 'd/m-Y'
DATETIME_FORMAT = 'd/m-Y H:i'
TIME_FORMAT = 'H:i'
2015-10-03 01:07:05 +00:00
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [local_dir('templates')],
'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',
'shop.context_processors.current_order',
2016-05-30 22:58:11 +00:00
'shop.context_processors.user_has_tickets',
2016-12-28 23:15:13 +00:00
'camps.context_processors.camp',
2015-10-03 01:07:05 +00:00
],
},
},
]
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # Handles login to admin with username
'allauth.account.auth_backends.AuthenticationBackend', # Handles regular logins
)
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = True
ACCOUNT_EMAIL_SUBJECT_PREFIX = '[bornhack] '
ACCOUNT_USERNAME_REQUIRED = False
2017-03-09 23:01:02 +00:00
LOGIN_REDIRECT_URL='/'
LOGIN_URL = '/login/'
2016-04-25 17:08:55 +00:00
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'
2016-05-06 20:51:07 +00:00
BOOTSTRAP3 = {
2016-05-06 21:30:07 +00:00
'jquery_url': '/static/js/jquery.min.js',
'javascript_url': '/static/js/bootstrap.min.js'
2016-05-06 20:51:07 +00:00
}
2017-01-31 22:26:45 +00:00
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'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',
]
if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
INSTALLED_APPS += ['debug_toolbar', ]
2017-01-31 22:26:45 +00:00
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware']
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
},
'console': {
'level':'DEBUG',
'class':'logging.StreamHandler',
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}