|
@ -40,8 +40,8 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media') |
|
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static') |
|
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static') |
|
|
|
|
|
|
|
|
STATICFILES_FINDERS = ( |
|
|
STATICFILES_FINDERS = ( |
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
|
|
'django.contrib.staticfiles.finders.FileSystemFinder', |
|
|
'django.contrib.staticfiles.finders.FileSystemFinder', |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
# Where redirect for login required services |
|
|
# Where redirect for login required services |
|
@ -57,41 +57,41 @@ DOBA_ODHLASENI_PRI_ZASKRTNUTI_NEODHLASOVAT = 365 * 24 * 3600 # rok |
|
|
# Modules configuration |
|
|
# Modules configuration |
|
|
|
|
|
|
|
|
AUTHENTICATION_BACKENDS = ( |
|
|
AUTHENTICATION_BACKENDS = ( |
|
|
'django.contrib.auth.backends.ModelBackend', |
|
|
'django.contrib.auth.backends.ModelBackend', |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MIDDLEWARE = ( |
|
|
MIDDLEWARE = ( |
|
|
# 'reversion.middleware.RevisionMiddleware', |
|
|
# 'reversion.middleware.RevisionMiddleware', |
|
|
'django.contrib.sessions.middleware.SessionMiddleware', |
|
|
'django.contrib.sessions.middleware.SessionMiddleware', |
|
|
'django.middleware.common.CommonMiddleware', |
|
|
'django.middleware.common.CommonMiddleware', |
|
|
'django.middleware.csrf.CsrfViewMiddleware', |
|
|
'django.middleware.csrf.CsrfViewMiddleware', |
|
|
# FIXME: rozbilo se při přechodu na Django 2.0, nevím, jestli |
|
|
# FIXME: rozbilo se při přechodu na Django 2.0, nevím, jestli |
|
|
# se to dá zahodit bez náhrady |
|
|
# se to dá zahodit bez náhrady |
|
|
# 'mamweb.middleware.LoggedInHintCookieMiddleware', |
|
|
# 'mamweb.middleware.LoggedInHintCookieMiddleware', |
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
|
'django.contrib.messages.middleware.MessageMiddleware', |
|
|
'django.contrib.messages.middleware.MessageMiddleware', |
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware', |
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware', |
|
|
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', |
|
|
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
TEMPLATES = [ |
|
|
TEMPLATES = [ |
|
|
{ |
|
|
{ |
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates', |
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates', |
|
|
'DIRS': [], |
|
|
'DIRS': [], |
|
|
'APP_DIRS': True, |
|
|
'APP_DIRS': True, |
|
|
'OPTIONS': { |
|
|
'OPTIONS': { |
|
|
'context_processors': ( |
|
|
'context_processors': ( |
|
|
'django.contrib.auth.context_processors.auth', |
|
|
'django.contrib.auth.context_processors.auth', |
|
|
'django.template.context_processors.request', |
|
|
'django.template.context_processors.request', |
|
|
'django.contrib.messages.context_processors.messages', |
|
|
'django.contrib.messages.context_processors.messages', |
|
|
'sekizai.context_processors.sekizai', |
|
|
'sekizai.context_processors.sekizai', |
|
|
'header_fotky.context_processors.vzhled', |
|
|
'header_fotky.context_processors.vzhled', |
|
|
'various.context_processors.rozliseni', |
|
|
'various.context_processors.rozliseni', |
|
|
'various.context_processors.april', |
|
|
'various.context_processors.april', |
|
|
) |
|
|
) |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -99,59 +99,59 @@ TEMPLATES = [ |
|
|
INSTALLED_APPS = ( |
|
|
INSTALLED_APPS = ( |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Basic |
|
|
# Basic |
|
|
'django.contrib.contenttypes', |
|
|
'django.contrib.contenttypes', |
|
|
'django.contrib.sessions', |
|
|
'django.contrib.sessions', |
|
|
'django.contrib.messages', |
|
|
'django.contrib.messages', |
|
|
'django.contrib.sites', |
|
|
'django.contrib.sites', |
|
|
'django.contrib.staticfiles', |
|
|
'django.contrib.staticfiles', |
|
|
'django.contrib.auth', |
|
|
'django.contrib.auth', |
|
|
|
|
|
|
|
|
# Utilities |
|
|
# Utilities |
|
|
'sekizai', |
|
|
'sekizai', |
|
|
'reversion', |
|
|
'reversion', |
|
|
'django_countries', |
|
|
'django_countries', |
|
|
'solo', |
|
|
'solo', |
|
|
'ckeditor', |
|
|
'ckeditor', |
|
|
'ckeditor_uploader', |
|
|
'ckeditor_uploader', |
|
|
'taggit', |
|
|
'taggit', |
|
|
'dal', |
|
|
'dal', |
|
|
'dal_select2', |
|
|
'dal_select2', |
|
|
|
|
|
|
|
|
'crispy_forms', |
|
|
'crispy_forms', |
|
|
'django_comments', |
|
|
'django_comments', |
|
|
|
|
|
|
|
|
'django.contrib.flatpages', |
|
|
'django.contrib.flatpages', |
|
|
'django.contrib.humanize', |
|
|
'django.contrib.humanize', |
|
|
|
|
|
|
|
|
'sitetree', |
|
|
'sitetree', |
|
|
|
|
|
|
|
|
'imagekit', |
|
|
'imagekit', |
|
|
|
|
|
|
|
|
'polymorphic', |
|
|
'polymorphic', |
|
|
|
|
|
|
|
|
'webpack_loader', |
|
|
'webpack_loader', |
|
|
'rest_framework', |
|
|
'rest_framework', |
|
|
'rest_framework.authtoken', |
|
|
'rest_framework.authtoken', |
|
|
|
|
|
|
|
|
# MaMweb |
|
|
# MaMweb |
|
|
'mamweb', |
|
|
'mamweb', |
|
|
'seminar', |
|
|
'seminar', |
|
|
'galerie', |
|
|
'galerie', |
|
|
'korektury', |
|
|
'korektury', |
|
|
'prednasky', |
|
|
'prednasky', |
|
|
'header_fotky', |
|
|
'header_fotky', |
|
|
'various', |
|
|
'various', |
|
|
'various.autentizace', |
|
|
'various.autentizace', |
|
|
'api', |
|
|
'api', |
|
|
'aesop', |
|
|
'aesop', |
|
|
'odevzdavatko', |
|
|
'odevzdavatko', |
|
|
'vysledkovky', |
|
|
'vysledkovky', |
|
|
'personalni', |
|
|
'personalni', |
|
|
'soustredeni', |
|
|
'soustredeni', |
|
|
'treenode', |
|
|
'treenode', |
|
|
|
|
|
|
|
|
# Admin upravy: |
|
|
# Admin upravy: |
|
|
|
|
|
|
|
|
# 'material', |
|
|
# 'material', |
|
|
# 'material.admin', |
|
|
# 'material.admin', |
|
@ -159,76 +159,76 @@ INSTALLED_APPS = ( |
|
|
# 'admin_tools.theming', |
|
|
# 'admin_tools.theming', |
|
|
# 'admin_tools.menu', |
|
|
# 'admin_tools.menu', |
|
|
# 'admin_tools.dashboard', |
|
|
# 'admin_tools.dashboard', |
|
|
'django.contrib.admin', |
|
|
'django.contrib.admin', |
|
|
|
|
|
|
|
|
# Nechat na konci (INSTALLED_APPS je uspořádané): |
|
|
# Nechat na konci (INSTALLED_APPS je uspořádané): |
|
|
'django_cleanup.apps.CleanupConfig', # Uklízí media/ |
|
|
'django_cleanup.apps.CleanupConfig', # Uklízí media/ |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
DEBUG_TOOLBAR_CONFIG = { |
|
|
DEBUG_TOOLBAR_CONFIG = { |
|
|
'SHOW_COLLAPSED': True, |
|
|
'SHOW_COLLAPSED': True, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
SUMMERNOTE_CONFIG = { |
|
|
SUMMERNOTE_CONFIG = { |
|
|
'iframe': False, |
|
|
'iframe': False, |
|
|
'airMode': False, |
|
|
'airMode': False, |
|
|
'attachment_require_authentication': True, |
|
|
'attachment_require_authentication': True, |
|
|
'width': '80%', |
|
|
'width': '80%', |
|
|
# 'height': '30em', |
|
|
# 'height': '30em', |
|
|
'toolbar': [ |
|
|
'toolbar': [ |
|
|
['style', ['style']], |
|
|
['style', ['style']], |
|
|
['font', ['bold', 'italic', 'superscript', 'subscript', 'clear']], |
|
|
['font', ['bold', 'italic', 'superscript', 'subscript', 'clear']], |
|
|
['color', ['color']], |
|
|
['color', ['color']], |
|
|
['para', ['ul', 'ol', 'paragraph']], |
|
|
['para', ['ul', 'ol', 'paragraph']], |
|
|
['table', ['table']], |
|
|
['table', ['table']], |
|
|
['insert', ['link', 'picture', 'hr']], |
|
|
['insert', ['link', 'picture', 'hr']], |
|
|
['view', ['fullscreen', 'codeview']], |
|
|
['view', ['fullscreen', 'codeview']], |
|
|
['help', ['help']], |
|
|
['help', ['help']], |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
CKEDITOR_UPLOAD_PATH = "uploads/" |
|
|
CKEDITOR_UPLOAD_PATH = "uploads/" |
|
|
CKEDITOR_IMAGE_BACKEND = 'pillow' |
|
|
CKEDITOR_IMAGE_BACKEND = 'pillow' |
|
|
#CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js' |
|
|
#CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js' |
|
|
CKEDITOR_CONFIGS = { |
|
|
CKEDITOR_CONFIGS = { |
|
|
'default': { |
|
|
'default': { |
|
|
'entities': False, |
|
|
'entities': False, |
|
|
'toolbar': [ |
|
|
'toolbar': [ |
|
|
['Source', 'ShowBlocks', '-', 'Maximize'], |
|
|
['Source', 'ShowBlocks', '-', 'Maximize'], |
|
|
['Bold', 'Italic', 'Subscript', 'Superscript', '-', 'RemoveFormat'], |
|
|
['Bold', 'Italic', 'Subscript', 'Superscript', '-', 'RemoveFormat'], |
|
|
['NumberedList','BulletedList','-','Blockquote','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], |
|
|
['NumberedList','BulletedList','-','Blockquote','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], |
|
|
['Link', 'Unlink', 'Anchor', '-', 'Image', 'Table', 'HorizontalRule'], |
|
|
['Link', 'Unlink', 'Anchor', '-', 'Image', 'Table', 'HorizontalRule'], |
|
|
['Format'], |
|
|
['Format'], |
|
|
|
|
|
|
|
|
], |
|
|
], |
|
|
# 'toolbar': 'full', |
|
|
# 'toolbar': 'full', |
|
|
'height': '40em', |
|
|
'height': '40em', |
|
|
'width': '100%', |
|
|
'width': '100%', |
|
|
'toolbarStartupExpanded': False, |
|
|
'toolbarStartupExpanded': False, |
|
|
'allowedContent' : True, |
|
|
'allowedContent' : True, |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Webpack loader |
|
|
# Webpack loader |
|
|
VUE_FRONTEND_DIR = os.path.join(BASE_DIR, 'vue_frontend') |
|
|
VUE_FRONTEND_DIR = os.path.join(BASE_DIR, 'vue_frontend') |
|
|
|
|
|
|
|
|
WEBPACK_LOADER = { |
|
|
WEBPACK_LOADER = { |
|
|
'DEFAULT': { |
|
|
'DEFAULT': { |
|
|
'CACHE': False, |
|
|
'CACHE': False, |
|
|
'BUNDLE_DIR_NAME': 'vue/', # must end with slash |
|
|
'BUNDLE_DIR_NAME': 'vue/', # must end with slash |
|
|
'STATS_FILE': os.path.join(VUE_FRONTEND_DIR, 'webpack-stats.json'), |
|
|
'STATS_FILE': os.path.join(VUE_FRONTEND_DIR, 'webpack-stats.json'), |
|
|
'POLL_INTERVAL': 0.1, |
|
|
'POLL_INTERVAL': 0.1, |
|
|
'TIMEOUT': None, |
|
|
'TIMEOUT': None, |
|
|
'IGNORE': [r'.+\.hot-update.js', r'.+\.map'] |
|
|
'IGNORE': [r'.+\.hot-update.js', r'.+\.map'] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Dajngo REST Framework |
|
|
# Dajngo REST Framework |
|
|
|
|
|
|
|
|
REST_FRAMEWORK = { |
|
|
REST_FRAMEWORK = { |
|
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', |
|
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', |
|
|
'PAGE_SIZE': 100 |
|
|
'PAGE_SIZE': 100 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -236,22 +236,22 @@ REST_FRAMEWORK = { |
|
|
# Create file 'django.secret' in every install (it is not kept in git) |
|
|
# Create file 'django.secret' in every install (it is not kept in git) |
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
|
with open(os.path.join(os.path.dirname(__file__), '..', 'django.secret')) as f: |
|
|
with open(os.path.join(os.path.dirname(__file__), '..', 'django.secret')) as f: |
|
|
SECRET_KEY = f.readline().strip() |
|
|
SECRET_KEY = f.readline().strip() |
|
|
except: |
|
|
except: |
|
|
SECRET_KEY = '12345zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzdqwkdlkj' |
|
|
SECRET_KEY = '12345zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzdqwkdlkj' |
|
|
|
|
|
|
|
|
# Logging |
|
|
# Logging |
|
|
|
|
|
|
|
|
LOGGING = { |
|
|
LOGGING = { |
|
|
'version': 1, |
|
|
'version': 1, |
|
|
'disable_existing_loggers': False, |
|
|
'disable_existing_loggers': False, |
|
|
|
|
|
|
|
|
'formatters': { |
|
|
'formatters': { |
|
|
'verbose': { |
|
|
'verbose': { |
|
|
'format': '%(levelname)s %(asctime)s %(module)s (logger %(name)s): %(message)s' |
|
|
'format': '%(levelname)s %(asctime)s %(module)s (logger %(name)s): %(message)s' |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
'filters': { |
|
|
'filters': { |
|
|
'Http404AsInfo': { |
|
|
'Http404AsInfo': { |
|
@ -262,76 +262,76 @@ LOGGING = { |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
'loggers': { |
|
|
'loggers': { |
|
|
|
|
|
|
|
|
'django': { |
|
|
'django': { |
|
|
'handlers': ['console'], |
|
|
'handlers': ['console'], |
|
|
'level': 'DEBUG', |
|
|
'level': 'DEBUG', |
|
|
'filters': ['StripSensitiveFormData'], |
|
|
'filters': ['StripSensitiveFormData'], |
|
|
}, |
|
|
}, |
|
|
'django.security.csrf': { |
|
|
'django.security.csrf': { |
|
|
'handlers': ['console'], |
|
|
'handlers': ['console'], |
|
|
'level': 'DEBUG', |
|
|
'level': 'DEBUG', |
|
|
'filters': ['StripSensitiveFormData'], |
|
|
'filters': ['StripSensitiveFormData'], |
|
|
}, |
|
|
}, |
|
|
'django.request': { |
|
|
'django.request': { |
|
|
'handlers': ['console'], |
|
|
'handlers': ['console'], |
|
|
'level': 'DEBUG', |
|
|
'level': 'DEBUG', |
|
|
'filters': ['Http404AsInfo'], |
|
|
'filters': ['Http404AsInfo'], |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
'seminar.prihlaska.form':{ |
|
|
'seminar.prihlaska.form':{ |
|
|
'handlers': ['console','registration_logfile'], |
|
|
'handlers': ['console','registration_logfile'], |
|
|
'level': 'INFO' |
|
|
'level': 'INFO' |
|
|
}, |
|
|
}, |
|
|
'seminar.prihlaska.problem':{ |
|
|
'seminar.prihlaska.problem':{ |
|
|
'handlers': ['console','mail_registration','registration_error_log'], |
|
|
'handlers': ['console','mail_registration','registration_error_log'], |
|
|
'level': 'INFO' |
|
|
'level': 'INFO' |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
# Catch-all logger |
|
|
# Catch-all logger |
|
|
'': { |
|
|
'': { |
|
|
'handlers': ['console'], # Add 'mail_admins' in prod and test |
|
|
'handlers': ['console'], # Add 'mail_admins' in prod and test |
|
|
'level': 'DEBUG', |
|
|
'level': 'DEBUG', |
|
|
'filters': ['StripSensitiveFormData'], |
|
|
'filters': ['StripSensitiveFormData'], |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
'handlers': { |
|
|
'handlers': { |
|
|
|
|
|
|
|
|
'console': { |
|
|
'console': { |
|
|
'level': 'WARNING', ## Set to 'DEBUG' in local |
|
|
'level': 'WARNING', ## Set to 'DEBUG' in local |
|
|
'class': 'logging.StreamHandler', |
|
|
'class': 'logging.StreamHandler', |
|
|
'formatter': 'verbose', |
|
|
'formatter': 'verbose', |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
'mail_admins': { |
|
|
'mail_admins': { |
|
|
'level': 'WARNING', |
|
|
'level': 'WARNING', |
|
|
'class': 'django.utils.log.AdminEmailHandler', |
|
|
'class': 'django.utils.log.AdminEmailHandler', |
|
|
'formatter': 'verbose', |
|
|
'formatter': 'verbose', |
|
|
'filters': ['StripSensitiveFormData'], |
|
|
'filters': ['StripSensitiveFormData'], |
|
|
}, |
|
|
}, |
|
|
'mail_registration': { |
|
|
'mail_registration': { |
|
|
'level': 'WARNING', |
|
|
'level': 'WARNING', |
|
|
'class': 'django.utils.log.AdminEmailHandler', |
|
|
'class': 'django.utils.log.AdminEmailHandler', |
|
|
'formatter': 'verbose', |
|
|
'formatter': 'verbose', |
|
|
}, |
|
|
}, |
|
|
'registration_logfile':{ |
|
|
'registration_logfile':{ |
|
|
'level': 'INFO', |
|
|
'level': 'INFO', |
|
|
'class': 'logging.FileHandler', |
|
|
'class': 'logging.FileHandler', |
|
|
# filename declared in specific configuration files |
|
|
# filename declared in specific configuration files |
|
|
'formatter': 'verbose', |
|
|
'formatter': 'verbose', |
|
|
}, |
|
|
}, |
|
|
'registration_error_log':{ |
|
|
'registration_error_log':{ |
|
|
'level': 'INFO', |
|
|
'level': 'INFO', |
|
|
'class': 'logging.FileHandler', |
|
|
'class': 'logging.FileHandler', |
|
|
# filename declared in specific configuration files |
|
|
# filename declared in specific configuration files |
|
|
'formatter': 'verbose', |
|
|
'formatter': 'verbose', |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Permissions for uploads |
|
|
# Permissions for uploads |
|
|
FILE_UPLOAD_PERMISSIONS = 0o0644 |
|
|
FILE_UPLOAD_PERMISSIONS = 0o0644 |
|
@ -352,14 +352,14 @@ POSLI_MAILOVOU_NOTIFIKACI = False |
|
|
|
|
|
|
|
|
# Logování chyb |
|
|
# Logování chyb |
|
|
class InvalidTemplateVariable(str): |
|
|
class InvalidTemplateVariable(str): |
|
|
def __mod__(self, variable): |
|
|
def __mod__(self, variable): |
|
|
import logging |
|
|
import logging |
|
|
logger = logging.getLogger(__name__) |
|
|
logger = logging.getLogger(__name__) |
|
|
for line in traceback.walk_stack(None): |
|
|
for line in traceback.walk_stack(None): |
|
|
if 'context' in line[0].f_locals and 'request' in line[0].f_locals['context']: |
|
|
if 'context' in line[0].f_locals and 'request' in line[0].f_locals['context']: |
|
|
logger.warning("Proměnná '%s' neexistuje: %s" % (variable, line[0].f_locals['context']['request'])) |
|
|
logger.warning("Proměnná '%s' neexistuje: %s" % (variable, line[0].f_locals['context']['request'])) |
|
|
break |
|
|
break |
|
|
return '' |
|
|
return '' |
|
|
TEMPLATES[0]['OPTIONS']['string_if_invalid'] = InvalidTemplateVariable('%s') |
|
|
TEMPLATES[0]['OPTIONS']['string_if_invalid'] = InvalidTemplateVariable('%s') |
|
|
|
|
|
|
|
|
# Django 3.2 vyžaduje explicitní nastavení autoklíče, zatím nechápu proč |
|
|
# Django 3.2 vyžaduje explicitní nastavení autoklíče, zatím nechápu proč |
|
|