Skip to content

Commit

Permalink
Merge 435bfab into 8a4ffaa
Browse files Browse the repository at this point in the history
  • Loading branch information
liangliangyy committed Jun 30, 2018
2 parents 8a4ffaa + 435bfab commit 60d08cf
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
48 changes: 39 additions & 9 deletions DjangoBlog/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""
import sys
import os
import raven

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand All @@ -30,6 +31,17 @@
ALLOWED_HOSTS = ['*', 'www.lylinux.net', '127.0.0.1', 'example.com']
# Application definition


SITE_ROOT = os.path.dirname(os.path.abspath(__file__))
SITE_ROOT = os.path.abspath(os.path.join(SITE_ROOT, '../'))

RAVEN_CONFIG = {
'dsn': os.environ.get('SENTRY_DSN'),
# If you are using git, you can also automatically configure the
# release based on the git info.
'release': raven.fetch_git_sha(os.path.abspath(SITE_ROOT)),
}

INSTALLED_APPS = [
# 'django.contrib.admin',
'django.contrib.admin.apps.SimpleAdminConfig',
Expand All @@ -40,6 +52,7 @@
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.sitemaps',
'raven.contrib.django.raven_compat',
'pagedown',
'haystack',
'blog',
Expand Down Expand Up @@ -138,9 +151,6 @@
# https://docs.djangoproject.com/en/1.10/howto/static-files/


SITE_ROOT = os.path.dirname(os.path.abspath(__file__))
SITE_ROOT = os.path.abspath(os.path.join(SITE_ROOT, '../'))

HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'DjangoBlog.whoosh_cn_backend.WhooshEngine',
Expand Down Expand Up @@ -193,7 +203,7 @@
# Emial:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

#EMAIL_USE_TLS = True
# EMAIL_USE_TLS = True
EMAIL_USE_SSL = True

EMAIL_HOST = 'smtp.mxhichina.com'
Expand All @@ -206,15 +216,20 @@
ADMINS = [('liangliang', 'liangliangyy@gmail.com')]
# 微信管理员密码(两次md5获得)
WXADMIN = '995F03AC401D6CABABAEF756FC4D43C7'

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'root': {
'level': 'WARNING',
'handlers': ['sentry', 'console', 'log_file'],
},
'formatters': {
'verbose': {
'format': '[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s',
},
'simple': {
'format': '%(levelname)s %(asctime)s %(message)s'
'format': '[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s',
},
},
'filters': {
Expand All @@ -229,7 +244,7 @@
'log_file': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'djangoblog.log',
'filename': 'xiaobiaobai.log',
'maxBytes': 16777216, # 16 MB
'formatter': 'verbose'
},
Expand All @@ -246,19 +261,34 @@
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'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'},
},
},
'loggers': {
'djangoblog': {
'xiaobiaobai': {
'handlers': ['log_file', 'console'],
'level': 'INFO',
'propagate': True,
},
'django.request': {
'handlers': ['mail_admins'],
'handlers': ['mail_admins', 'sentry'],
'level': 'ERROR',
'propagate': False,
},
'raven': {
'level': 'DEBUG',
'handlers': ['console'],
'propagate': False,
},
'sentry.errors': {
'level': 'DEBUG',
'handlers': ['console'],
'propagate': False,
},
}
}

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pyparsing==2.2.0
python-memcached==1.59
python-slugify==1.2.5
pytz==2018.4
raven==6.9.0
rcssmin==1.0.6
requests==2.18.4
rjsmin==1.0.12
Expand Down
1 change: 1 addition & 0 deletions travis_test/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PyMySQL==0.8.1
pyparsing==2.2.0
python-slugify==1.2.5
pytz==2018.4
raven==6.9.0
rcssmin==1.0.6
requests==2.18.4
rjsmin==1.0.12
Expand Down

0 comments on commit 60d08cf

Please sign in to comment.