prod
Dmitriy Shesterkin 9 years ago
parent a79325ee39
commit 77fc0b9b16
  1. 116
      src/dokumentor/settings/common.py
  2. 3
      src/dokumentor/wsgi.py

@ -4,6 +4,7 @@
import os
import sys
from datetime import timedelta
import raven
import envvars as e
@ -77,6 +78,7 @@ STATICFILES_DIRS = (
)
MIDDLEWARE_CLASSES = [
'raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
@ -161,6 +163,7 @@ INSTALLED_APPS = [
'easy_thumbnails',
'treebeard',
'djangocms_text_ckeditor',
'raven.contrib.django.raven_compat',
]
LOCAL_APPS = [
@ -179,41 +182,6 @@ AUTH_USER_MODEL = 'myauth.DokUser'
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'yandex_money': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(ROOT_DIR, 'var/log/yandex_money.log'),
'maxBytes': 1024 * 1024 * 5,
'backupCount': 5,
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
'yandex_money': {
'handlers': ['yandex_money'],
'level': 'DEBUG',
'propagate': False
},
}
}
SERVER_EMAIL = 'dokumentor@localhost'
EMAIL_SUBJECT_PREFIX = '[DOKUMENTOR.RU] '
@ -313,6 +281,13 @@ THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.filters'
)
RAVEN_CONFIG = {
'dsn': 'http://301aa893690e42f1938508848a43745c:722a270798654c6fb5f14f31e6073e3c@sentry.mitri4.pro/1',
# If you are using git, you can also automatically configure the
# release based on the git info.
'release': raven.fetch_git_sha(os.path.dirname(os.pardir)),
}
# cache settings
COMMON_CACHE_PREFIX = 'dokumentor_'
CMS_CACHE_PREFIX = '%scms-' % COMMON_CACHE_PREFIX
@ -343,3 +318,74 @@ DADATA_API_KEY = 'e4232c46f82c0b2e8c5f9bd583d6224ce9c934e0'
DADATA_SECRET_KEY = '9c5c3fdfba74af122730db650346b3e91586abc7'
SITE_URL = 'https://dokumentor.ru'
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'root': {
'level': 'WARNING',
'handlers': ['sentry'],
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s '
'%(process)d %(thread)d %(message)s'
},
},
'handlers': {
'sentry': {
'level': 'ERROR', # To capture more than ERROR, change to WARNING, INFO, etc.
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
'tags': {'custom-tag': 'x'},
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'yandex_money': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(ROOT_DIR, 'var/log/yandex_money.log'),
'maxBytes': 1024 * 1024 * 5,
'backupCount': 5,
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
'django.db.backends': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
'raven': {
'level': 'DEBUG',
'handlers': ['console'],
'propagate': False,
},
'sentry.errors': {
'level': 'DEBUG',
'handlers': ['console'],
'propagate': False,
},
'yandex_money': {
'handlers': ['yandex_money'],
'level': 'DEBUG',
'propagate': False
},
},
}

@ -1,6 +1,7 @@
import os
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.dokumentor.settings")
from django.core.wsgi import get_wsgi_application # noqa
application = get_wsgi_application()
application = Sentry(get_wsgi_application())

Loading…
Cancel
Save