Web M&M
https://mam.matfyz.cz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
311 lines
7.8 KiB
311 lines
7.8 KiB
"""
|
|
Django settings for mamweb project.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/1.7/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/1.7/ref/settings/
|
|
"""
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
import os
|
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
|
|
|
# Application definition
|
|
|
|
SITE_ID = 1
|
|
ROOT_URLCONF = 'mamweb.urls'
|
|
WSGI_APPLICATION = 'mamweb.wsgi.application'
|
|
|
|
APPEND_SLASH = True
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'cs'
|
|
TIME_ZONE = 'Europe/Prague'
|
|
USE_I18N = True
|
|
USE_L10N = True
|
|
USE_TZ = True
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
MEDIA_URL = '/media/'
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
|
|
|
STATICFILES_FINDERS = (
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
)
|
|
|
|
# Where redirect for login required services
|
|
LOGIN_URL = 'login'
|
|
|
|
# Modules configuration
|
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
)
|
|
|
|
|
|
MIDDLEWARE = (
|
|
# 'reversion.middleware.RevisionMiddleware',
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
# FIXME: rozbilo se při přechodu na Django 2.0, nevím, jestli
|
|
# se to dá zahodit bez náhrady
|
|
# 'mamweb.middleware.LoggedInHintCookieMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
|
)
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': (
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.template.context_processors.request',
|
|
'django.contrib.messages.context_processors.messages',
|
|
'sekizai.context_processors.sekizai',
|
|
'header_fotky.context_processors.vzhled',
|
|
)
|
|
},
|
|
},
|
|
]
|
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
|
|
|
|
|
# Basic
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.sites',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.auth',
|
|
|
|
# Utilities
|
|
'sekizai',
|
|
'reversion',
|
|
'django_countries',
|
|
'solo',
|
|
'ckeditor',
|
|
'ckeditor_uploader',
|
|
'taggit',
|
|
'dal',
|
|
'dal_select2',
|
|
|
|
'fluent_comments',
|
|
'crispy_forms',
|
|
'threadedcomments',
|
|
'django_comments',
|
|
|
|
'django.contrib.flatpages',
|
|
'django.contrib.humanize',
|
|
|
|
'sitetree',
|
|
|
|
'imagekit',
|
|
|
|
'polymorphic',
|
|
|
|
'webpack_loader',
|
|
'rest_framework',
|
|
'rest_framework.authtoken',
|
|
|
|
# MaMweb
|
|
'mamweb',
|
|
'seminar',
|
|
'galerie',
|
|
'korektury',
|
|
'prednasky',
|
|
'header_fotky',
|
|
|
|
# Admin upravy:
|
|
|
|
# 'material',
|
|
# 'material.admin',
|
|
# 'admin_tools',
|
|
# 'admin_tools.theming',
|
|
# 'admin_tools.menu',
|
|
# 'admin_tools.dashboard',
|
|
'django.contrib.admin',
|
|
)
|
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
|
'SHOW_COLLAPSED': True,
|
|
}
|
|
|
|
SUMMERNOTE_CONFIG = {
|
|
'iframe': False,
|
|
'airMode': False,
|
|
'attachment_require_authentication': True,
|
|
'width': '80%',
|
|
# 'height': '30em',
|
|
'toolbar': [
|
|
['style', ['style']],
|
|
['font', ['bold', 'italic', 'superscript', 'subscript', 'clear']],
|
|
['color', ['color']],
|
|
['para', ['ul', 'ol', 'paragraph']],
|
|
['table', ['table']],
|
|
['insert', ['link', 'picture', 'hr']],
|
|
['view', ['fullscreen', 'codeview']],
|
|
['help', ['help']],
|
|
]
|
|
}
|
|
|
|
CKEDITOR_UPLOAD_PATH = "uploads/"
|
|
CKEDITOR_IMAGE_BACKEND = 'pillow'
|
|
#CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
|
|
CKEDITOR_CONFIGS = {
|
|
'default': {
|
|
'entities': False,
|
|
'toolbar': [
|
|
['Source', 'ShowBlocks', '-', 'Maximize'],
|
|
['Bold', 'Italic', 'Subscript', 'Superscript', '-', 'RemoveFormat'],
|
|
['NumberedList','BulletedList','-','Blockquote','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
|
['Link', 'Unlink', 'Anchor', '-', 'Image', 'Table', 'HorizontalRule'],
|
|
['Format'],
|
|
|
|
],
|
|
# 'toolbar': 'full',
|
|
'height': '40em',
|
|
'width': '100%',
|
|
'toolbarStartupExpanded': False,
|
|
'allowedContent' : True,
|
|
},
|
|
}
|
|
|
|
# Webpack loader
|
|
VUE_FRONTEND_DIR = os.path.join(BASE_DIR, 'vue_frontend')
|
|
|
|
WEBPACK_LOADER = {
|
|
'DEFAULT': {
|
|
'CACHE': False,
|
|
'BUNDLE_DIR_NAME': 'vue/', # must end with slash
|
|
'STATS_FILE': os.path.join(VUE_FRONTEND_DIR, 'webpack-stats.json'),
|
|
'POLL_INTERVAL': 0.1,
|
|
'TIMEOUT': None,
|
|
'IGNORE': [r'.+\.hot-update.js', r'.+\.map']
|
|
}
|
|
}
|
|
|
|
|
|
# Dajngo REST Framework
|
|
|
|
REST_FRAMEWORK = {
|
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
|
|
'PAGE_SIZE': 100
|
|
}
|
|
|
|
# Comments
|
|
|
|
COMMENTS_APP = 'fluent_comments'
|
|
#COMMENTS_APP = 'threadedcomments'
|
|
FLUENT_COMMENTS_EXCLUDE_FIELDS = ('name', 'email', 'url', 'title')
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
# Create file 'django.secret' in every install (it is not kept in git)
|
|
|
|
try:
|
|
with open(os.path.join(os.path.dirname(__file__), '..', 'django.secret')) as f:
|
|
SECRET_KEY = f.readline().strip()
|
|
except:
|
|
SECRET_KEY = '12345zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzdqwkdlkj'
|
|
|
|
# Logging
|
|
|
|
LOGGING = {
|
|
'version': 1,
|
|
'disable_existing_loggers': False,
|
|
|
|
'formatters': {
|
|
'verbose': {
|
|
'format': '%(levelname)s %(asctime)s %(module)s: %(message)s'
|
|
},
|
|
},
|
|
|
|
'loggers': {
|
|
|
|
'django': {
|
|
'handlers': ['console'],
|
|
'level': 'DEBUG',
|
|
},
|
|
'seminar.prihlaska.form':{
|
|
'handlers': ['console','registration_logfile'],
|
|
'level': 'INFO'
|
|
},
|
|
'seminar.prihlaska.problem':{
|
|
'handlers': ['console','mail_registration','registration_error_log'],
|
|
'level': 'INFO'
|
|
},
|
|
|
|
# Catch-all logger
|
|
'': {
|
|
'handlers': ['console'], # Add 'mail_admins' in prod and test
|
|
'level': 'DEBUG',
|
|
},
|
|
|
|
},
|
|
|
|
'handlers': {
|
|
|
|
'console': {
|
|
'level': 'WARNING', ## Set to 'DEBUG' in local
|
|
'class': 'logging.StreamHandler',
|
|
'formatter': 'verbose',
|
|
},
|
|
|
|
'mail_admins': {
|
|
'level': 'ERROR',
|
|
'class': 'django.utils.log.AdminEmailHandler',
|
|
'formatter': 'verbose',
|
|
},
|
|
'mail_registration': {
|
|
'level': 'WARN',
|
|
'class': 'django.utils.log.AdminEmailHandler',
|
|
'formatter': 'verbose',
|
|
},
|
|
'registration_logfile':{
|
|
'level': 'INFO',
|
|
'class': 'logging.FileHandler',
|
|
# filename declared in specific configuration files
|
|
'formatter': 'verbose',
|
|
},
|
|
'registration_error_log':{
|
|
'level': 'INFO',
|
|
'class': 'logging.FileHandler',
|
|
# filename declared in specific configuration files
|
|
'formatter': 'verbose',
|
|
},
|
|
|
|
},
|
|
}
|
|
|
|
# Permissions for uploads
|
|
FILE_UPLOAD_PERMISSIONS = 0o0644
|
|
|
|
# MaM specific
|
|
|
|
SEMINAR_RESENI_DIR = os.path.join('reseni')
|
|
SEMINAR_KONFERY_DIR = os.path.join('konfery')
|
|
KOREKTURY_PDF_DIR = os.path.join('korektury', 'pdf')
|
|
KOREKTURY_IMG_DIR = os.path.join('korektury', 'img')
|
|
CISLO_IMG_DIR = os.path.join('cislo', 'img')
|
|
|
|
|
|
# E-MAIL NOTIFICATIONS
|
|
POSLI_MAILOVOU_NOTIFIKACI = False
|
|
|