Uhlazena konfigurace (settings_*.py)
This commit is contained in:
parent
e85c333bf8
commit
f707cc02f7
5 changed files with 174 additions and 228 deletions
|
@ -1,68 +1,56 @@
|
||||||
"""
|
|
||||||
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
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
SITE_ID = 1
|
SITE_ID = 1
|
||||||
ROOT_URLCONF = 'mamweb.urls'
|
ROOT_URLCONF = 'mamweb.urls'
|
||||||
WSGI_APPLICATION = 'mamweb.wsgi.application'
|
WSGI_APPLICATION = 'mamweb.wsgi.application'
|
||||||
|
|
||||||
APPEND_SLASH = True
|
# Lokalizace
|
||||||
|
|
||||||
# Internationalization
|
|
||||||
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
|
||||||
|
|
||||||
LANGUAGE_CODE = 'cs'
|
LANGUAGE_CODE = 'cs'
|
||||||
TIME_ZONE = 'Europe/Prague'
|
TIME_ZONE = 'Europe/Prague'
|
||||||
USE_I18N = True
|
USE_L10N = True # S přechodem k djangu>=4 lze smazat (localized formatting)
|
||||||
USE_L10N = True
|
USE_TZ = True # S přechodem k djangu>=5 lze smazat (timezone aware datetimes)
|
||||||
USE_TZ = True
|
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
|
||||||
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
|
||||||
|
|
||||||
|
# Statické soubory (CSS, JavaScript, obrázky) a další média
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
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
|
# URL pro přihlášení (default je account/login)
|
||||||
LOGIN_URL = 'login'
|
LOGIN_URL = 'login'
|
||||||
LOGIN_REDIRECT_URL = 'profil'
|
LOGIN_REDIRECT_URL = 'profil'
|
||||||
|
|
||||||
|
|
||||||
# Odhlášení po zavření prohlížeče
|
# Odhlášení po zavření prohlížeče
|
||||||
# (pozor nefunguje na firefox se znovuotevíráním oken po startu firefoxu)
|
# (pozor nefunguje na firefox se znovuotevíráním oken po startu firefoxu)
|
||||||
# default je False a SESSION_COOKIE_AGE = 3600*24*14 = 2 týdny
|
# default je False a SESSION_COOKIE_AGE = 3600*24*14 = 2 týdny
|
||||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
||||||
DOBA_ODHLASENI_PRI_ZASKRTNUTI_NEODHLASOVAT = 365 * 24 * 3600 # rok
|
DOBA_ODHLASENI_PRI_ZASKRTNUTI_NEODHLASOVAT = 365 * 24 * 3600 # rok
|
||||||
|
|
||||||
# Modules configuration
|
|
||||||
|
|
||||||
|
# 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'
|
||||||
|
|
||||||
|
|
||||||
|
# Přidávání dalších součástí (do) djangovské mašinérie
|
||||||
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',
|
||||||
|
@ -71,7 +59,6 @@ MIDDLEWARE = (
|
||||||
'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',
|
||||||
|
@ -80,7 +67,7 @@ TEMPLATES = [
|
||||||
'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',
|
||||||
|
@ -90,12 +77,7 @@ TEMPLATES = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
|
|
||||||
|
|
||||||
# Basic
|
# Basic
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
|
@ -151,59 +133,50 @@ INSTALLED_APPS = (
|
||||||
|
|
||||||
# Admin upravy:
|
# Admin upravy:
|
||||||
|
|
||||||
# 'material',
|
# 'material',
|
||||||
# 'material.admin',
|
# 'material.admin',
|
||||||
# 'admin_tools',
|
# 'admin_tools',
|
||||||
# '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 = {
|
|
||||||
'SHOW_COLLAPSED': True,
|
|
||||||
}
|
|
||||||
|
|
||||||
SUMMERNOTE_CONFIG = {
|
# MaM-specifické složky
|
||||||
'iframe': False,
|
SEMINAR_RESENI_DIR = os.path.join('reseni')
|
||||||
'airMode': False,
|
SEMINAR_KONFERY_DIR = os.path.join('konfery')
|
||||||
'attachment_require_authentication': True,
|
KOREKTURY_PDF_DIR = os.path.join('korektury', 'pdf')
|
||||||
'width': '80%',
|
KOREKTURY_IMG_DIR = os.path.join('korektury', 'img')
|
||||||
# 'height': '30em',
|
CISLO_IMG_DIR = os.path.join('cislo', 'img')
|
||||||
'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']],
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
# MaM-specifické konstanty
|
||||||
|
# TODO (e-maily atd.)
|
||||||
|
|
||||||
|
|
||||||
|
# CKEditor = WYSIWYG html editor
|
||||||
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,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,31 +196,21 @@ WEBPACK_LOADER = {
|
||||||
|
|
||||||
|
|
||||||
# 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# Logování
|
||||||
# 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 = {
|
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'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -278,18 +241,18 @@ LOGGING = {
|
||||||
'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'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
'filters': ['StripSensitiveFormData'],
|
'filters': ['StripSensitiveFormData'],
|
||||||
},
|
},
|
||||||
|
@ -299,7 +262,7 @@ LOGGING = {
|
||||||
'handlers': {
|
'handlers': {
|
||||||
|
|
||||||
'console': {
|
'console': {
|
||||||
'level': 'WARNING', ## Set to 'DEBUG' in local
|
'level': 'WARNING',
|
||||||
'class': 'logging.StreamHandler',
|
'class': 'logging.StreamHandler',
|
||||||
'formatter': 'verbose',
|
'formatter': 'verbose',
|
||||||
},
|
},
|
||||||
|
@ -315,36 +278,24 @@ LOGGING = {
|
||||||
'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
|
|
||||||
FILE_UPLOAD_PERMISSIONS = 0o0644
|
|
||||||
|
|
||||||
# MaM specific
|
# Logování neexistujících proměnných v templatech
|
||||||
|
|
||||||
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')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Logování chyb
|
|
||||||
class InvalidTemplateVariable(str):
|
class InvalidTemplateVariable(str):
|
||||||
def __mod__(self, variable):
|
def __mod__(self, variable):
|
||||||
import logging
|
import logging
|
||||||
|
@ -356,5 +307,38 @@ class InvalidTemplateVariable(str):
|
||||||
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č
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
||||||
|
|
||||||
|
|
||||||
|
# TODO odstranit? (Je to default.)
|
||||||
|
# Whether to append trailing slashes to URLs.
|
||||||
|
APPEND_SLASH = True
|
||||||
|
# TODO odstranit? (Je to default.)
|
||||||
|
# Permissions for uploads
|
||||||
|
FILE_UPLOAD_PERMISSIONS = 0o0644
|
||||||
|
# TODO odstranit? (Je to default.)
|
||||||
|
# Automatická lokalizace
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
|
||||||
|
# TODO odstranit? (Nevím o tom, že bychom ho někde používali.)
|
||||||
|
# Summernote = WYSIWYG editor (pro admin?)
|
||||||
|
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']],
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
22
mamweb/settings_common_debug.py
Normal file
22
mamweb/settings_common_debug.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
from .settings_common import *
|
||||||
|
|
||||||
|
DEBUG = True
|
||||||
|
TEMPLATES[0]['OPTIONS']['debug'] = True
|
||||||
|
|
||||||
|
MIDDLEWARE += (
|
||||||
|
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||||
|
)
|
||||||
|
|
||||||
|
INSTALLED_APPS += (
|
||||||
|
'debug_toolbar', # Takovéto užitečné (pro debug) na html stránce vpravo
|
||||||
|
'django_extensions', # Kolekce zajímavých ./manage.py commandů
|
||||||
|
)
|
||||||
|
|
||||||
|
DEBUG_TOOLBAR_CONFIG = {
|
||||||
|
'SHOW_COLLAPSED': True,
|
||||||
|
}
|
||||||
|
|
||||||
|
# Nechceme nikomu omylem poslat e-mail
|
||||||
|
# Když někdo spustí omylem tohle nastavení, prostě to při poslání mailu spadne
|
||||||
|
# V settings_local a settings_test přepíšeme...
|
||||||
|
EMAIL_BACKEND = None
|
|
@ -1,5 +1,3 @@
|
||||||
import os.path
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Lokalni / vyvojove nastaveni settings.py
|
# Lokalni / vyvojove nastaveni settings.py
|
||||||
#
|
#
|
||||||
|
@ -7,35 +5,20 @@ import os.path
|
||||||
# DJANGO_SETTINGS_MODULE=mamweb.settings_local ./manage.py ...
|
# DJANGO_SETTINGS_MODULE=mamweb.settings_local ./manage.py ...
|
||||||
#
|
#
|
||||||
|
|
||||||
# Import common settings
|
import os.path
|
||||||
from .settings_common import *
|
|
||||||
|
|
||||||
MIDDLEWARE += (
|
|
||||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
|
||||||
)
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
|
||||||
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
|
||||||
|
|
||||||
INSTALLED_APPS += (
|
|
||||||
'debug_toolbar',
|
|
||||||
'django_extensions',
|
|
||||||
)
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
|
||||||
DEBUG = True
|
|
||||||
INTERNAL_IPS = ['127.0.0.1']
|
|
||||||
|
|
||||||
TEMPLATES[0]['OPTIONS']['debug'] = True
|
|
||||||
|
|
||||||
from ipaddress import ip_network
|
from ipaddress import ip_network
|
||||||
|
|
||||||
|
from .settings_common_debug import *
|
||||||
|
LOCAL_TEST_PROD = "local"
|
||||||
|
|
||||||
|
|
||||||
|
INTERNAL_IPS = ['127.0.0.1']
|
||||||
ALLOWED_HOSTS = [str(ip) for ip in ip_network('192.168.0.0/16')]
|
ALLOWED_HOSTS = [str(ip) for ip in ip_network('192.168.0.0/16')]
|
||||||
ALLOWED_HOSTS.append('127.0.0.1')
|
ALLOWED_HOSTS += ['127.0.0.1', 'localhost']
|
||||||
ALLOWED_HOSTS.append('localhost')
|
|
||||||
|
|
||||||
# Database
|
|
||||||
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
|
|
||||||
|
|
||||||
|
# Databáze
|
||||||
|
# SQLite
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
@ -45,15 +28,21 @@ DATABASES = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
#DATABASES = {
|
# # PostgreSQL
|
||||||
# 'default': {
|
# DATABASES = {
|
||||||
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
# 'default': {
|
||||||
# 'NAME': 'mam_local',
|
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
# 'USER': 'mam',
|
# 'NAME': 'mam_local',
|
||||||
# },
|
# 'USER': 'mam',
|
||||||
#}
|
# },
|
||||||
|
# }
|
||||||
|
|
||||||
# LOGGING
|
|
||||||
|
# E-maily posílat chceme, ale do terminálu :-)
|
||||||
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||||
|
|
||||||
|
|
||||||
|
# Logování
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'disable_existing_loggers': True,
|
'disable_existing_loggers': True,
|
||||||
|
@ -78,12 +67,6 @@ LOGGING = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'loggers': {
|
'loggers': {
|
||||||
# Vypisovani databazovych dotazu do konzole
|
|
||||||
#'django.db.backends': {
|
|
||||||
# 'level': 'DEBUG',
|
|
||||||
# 'handlers': ['console'],
|
|
||||||
# 'propagate': False,
|
|
||||||
#},
|
|
||||||
'werkzeug': {
|
'werkzeug': {
|
||||||
'handlers': ['console'],
|
'handlers': ['console'],
|
||||||
'level': 'DEBUG',
|
'level': 'DEBUG',
|
||||||
|
@ -96,11 +79,3 @@ LOGGING = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
# set to 'DEBUG' for EXTRA verbose output
|
|
||||||
# LOGGING['handlers']['console']['level'] = 'INFO'
|
|
||||||
|
|
||||||
# E-maily posílat chceme, ale do terminálu :-)
|
|
||||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
||||||
|
|
||||||
LOCAL_TEST_PROD = "local"
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Produkcni nastaveni settings.py
|
# Produkcni nastaveni settings.py
|
||||||
#
|
#
|
||||||
|
@ -10,27 +7,27 @@ import os.path
|
||||||
|
|
||||||
# Import common settings
|
# Import common settings
|
||||||
from .settings_common import *
|
from .settings_common import *
|
||||||
|
LOCAL_TEST_PROD = "prod"
|
||||||
|
|
||||||
|
|
||||||
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
|
||||||
|
|
||||||
INSTALLED_APPS += (
|
|
||||||
'django_extensions',
|
|
||||||
)
|
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
|
||||||
assert not SECRET_KEY.startswith('12345')
|
assert not SECRET_KEY.startswith('12345')
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
TEMPLATE_DEBUG = False
|
TEMPLATE_DEBUG = False
|
||||||
|
# SECURITY: only send sensitive cookies via HTTPS
|
||||||
|
SESSION_COOKIE_SECURE = True
|
||||||
|
CSRF_COOKIE_SECURE = True
|
||||||
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['mam.mff.cuni.cz', 'www.mam.mff.cuni.cz', 'gimli.ms.mff.cuni.cz']
|
ALLOWED_HOSTS = ['mam.mff.cuni.cz', 'www.mam.mff.cuni.cz', 'gimli.ms.mff.cuni.cz']
|
||||||
|
|
||||||
# Database
|
# Přidání aplikací
|
||||||
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
|
INSTALLED_APPS += (
|
||||||
|
'django_extensions', # Kolekce zajímavých ./manage.py commandů
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Databáze
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
|
@ -42,25 +39,14 @@ DATABASES = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
import os
|
# Nastavení e-mailů (odkud a kam mají chodit)
|
||||||
|
|
||||||
SERVER_EMAIL = 'mamweb-prod-errors@mam.mff.cuni.cz'
|
SERVER_EMAIL = 'mamweb-prod-errors@mam.mff.cuni.cz'
|
||||||
ADMINS = [('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz')]
|
ADMINS = [('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz')]
|
||||||
|
|
||||||
|
|
||||||
# SECURITY: only send sensitive cookies via HTTPS
|
# Logování
|
||||||
|
|
||||||
SESSION_COOKIE_SECURE = True
|
|
||||||
CSRF_COOKIE_SECURE = True
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# LOGGING
|
|
||||||
|
|
||||||
LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins']
|
LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins']
|
||||||
LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins']
|
LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins']
|
||||||
LOGGING['loggers']['django.security.csrf']['level'] = 'ERROR'
|
LOGGING['loggers']['django.security.csrf']['level'] = 'ERROR'
|
||||||
LOGGING['handlers']['registration_logfile']['filename'] = '/home/mam-web/logs/prod/registration.log'
|
LOGGING['handlers']['registration_logfile']['filename'] = '/home/mam-web/logs/prod/registration.log'
|
||||||
LOGGING['handlers']['registration_error_log']['filename'] = '/home/mam-web/logs/prod/registration_errors.log'
|
LOGGING['handlers']['registration_error_log']['filename'] = '/home/mam-web/logs/prod/registration_errors.log'
|
||||||
|
|
||||||
LOCAL_TEST_PROD = "prod"
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Testovaci nastaveni settings.py (testovani na mam-test.ks.marfyz.cz)
|
# Testovaci nastaveni settings.py (testovani na mam-test.ks.marfyz.cz)
|
||||||
#
|
#
|
||||||
|
@ -8,34 +5,20 @@ import os.path
|
||||||
# DJANGO_SETTINGS_MODULE=mamweb.settings_test ./manage.py ...
|
# DJANGO_SETTINGS_MODULE=mamweb.settings_test ./manage.py ...
|
||||||
#
|
#
|
||||||
|
|
||||||
# Import common settings
|
from .settings_common_debug import *
|
||||||
from .settings_common import * # zatim nutne, casem snad vyresime # noqa
|
LOCAL_TEST_PROD = "test"
|
||||||
|
|
||||||
MIDDLEWARE += (
|
|
||||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
|
||||||
)
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
|
||||||
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
|
||||||
|
|
||||||
INSTALLED_APPS += (
|
|
||||||
'debug_toolbar',
|
|
||||||
'django_extensions',
|
|
||||||
)
|
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
|
||||||
SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzv9l+zo)n'
|
SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzv9l+zo)n'
|
||||||
|
# SECURITY: only send sensitive cookies via HTTPS
|
||||||
|
SESSION_COOKIE_SECURE = True
|
||||||
|
CSRF_COOKIE_SECURE = True
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
|
||||||
DEBUG = True
|
|
||||||
|
|
||||||
TEMPLATES[0]['OPTIONS']['debug'] = True
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['mam-test.kam.mff.cuni.cz', 'gimli.ms.mff.cuni.cz', 'mam-test.ks.matfyz.cz']
|
ALLOWED_HOSTS = ['mam-test.kam.mff.cuni.cz', 'gimli.ms.mff.cuni.cz', 'mam-test.ks.matfyz.cz']
|
||||||
|
|
||||||
# Database
|
|
||||||
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
|
|
||||||
|
|
||||||
|
# Databáze
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
|
@ -47,31 +30,27 @@ DATABASES = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
# Nastavení e-mailů (odkud a kam mají chodit)
|
||||||
SERVER_EMAIL = 'mamweb-test-errors@mam.mff.cuni.cz'
|
SERVER_EMAIL = 'mamweb-test-errors@mam.mff.cuni.cz'
|
||||||
ADMINS = [
|
ADMINS = [
|
||||||
('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz'),
|
('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# SECURITY: only send sensitive cookies via HTTPS
|
|
||||||
|
|
||||||
SESSION_COOKIE_SECURE = True
|
|
||||||
CSRF_COOKIE_SECURE = True
|
|
||||||
|
|
||||||
# LOGGING
|
|
||||||
|
|
||||||
LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins']
|
|
||||||
LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins']
|
|
||||||
LOGGING['handlers']['registration_logfile']['filename'] = '/home/mam-web/logs/test/registration.log'
|
|
||||||
LOGGING['handlers']['registration_error_log']['filename'] = '/home/mam-web/logs/test/registration_errors.log'
|
|
||||||
|
|
||||||
FILE_UPLOAD_PERMISSIONS = 0o440
|
|
||||||
|
|
||||||
# Testování e-mailů
|
# Testování e-mailů
|
||||||
EMAIL_BACKEND = 'various.mail_prefixer.PrefixingMailBackend'
|
EMAIL_BACKEND = 'various.mail_prefixer.PrefixingMailBackend'
|
||||||
# TODO Pouze na otestování testu… Zvolit konferu!
|
# TODO Pouze na otestování testu… Zvolit konferu!
|
||||||
# XXX: Je to pole, protože implementační detail backendu.
|
# XXX: Je to pole, protože implementační detail backendu.
|
||||||
TESTOVACI_EMAILOVA_KONFERENCE = ['betatest@mam.mff.cuni.cz']
|
TESTOVACI_EMAILOVA_KONFERENCE = ['betatest@mam.mff.cuni.cz']
|
||||||
LOCAL_TEST_PROD = "test"
|
|
||||||
|
|
||||||
|
# Netuším proč (Jidáš)...
|
||||||
|
FILE_UPLOAD_PERMISSIONS = 0o440
|
||||||
|
|
||||||
|
|
||||||
|
# Logování
|
||||||
|
LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins']
|
||||||
|
LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins']
|
||||||
|
LOGGING['handlers']['registration_logfile']['filename'] = '/home/mam-web/logs/test/registration.log'
|
||||||
|
LOGGING['handlers']['registration_error_log']['filename'] = '/home/mam-web/logs/test/registration_errors.log'
|
||||||
|
|
Loading…
Reference in a new issue