Add production logging support

remotes/origin/PR-39
ArturBaybulatov 10 years ago
parent ff72424526
commit e7ccbc914c
  1. 33
      archilance/settings/prod.py
  2. 12
      archilance/views.py

@ -17,3 +17,36 @@ DEBUG = True
TEMPLATE_DEBUG = True TEMPLATE_DEBUG = True
THUMBNAIL_DEBUG = True THUMBNAIL_DEBUG = True
SECRET_KEY = 'vb6@b9zj7^f!^+x*e8=e!oundyu1!e*&0i(3gu2xwo4%fx4h&n' SECRET_KEY = 'vb6@b9zj7^f!^+x*e8=e!oundyu1!e*&0i(3gu2xwo4%fx4h&n'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'main_formatter': {
'format': '%(levelname)s:%(name)s: %(message)s '
'(%(asctime)s; %(filename)s:%(lineno)d)',
'datefmt': "%Y-%m-%d %H:%M:%S",
},
},
'handlers': {
'production_file': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'main.log',
'maxBytes': 1024 * 1024 * 5, # 5 MB
'backupCount': 7,
'formatter': 'main_formatter',
}
},
'loggers': {
'django.request': {
'handlers': ['production_file'],
'level': 'ERROR',
'propagate': True,
},
'': {
'handlers': ['production_file'],
'level': "DEBUG",
},
}
}

@ -1,14 +1,16 @@
from django.views.generic import TemplateView, View from django.core.files.base import ContentFile
from django.shortcuts import render from django.shortcuts import render
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.core.files.base import ContentFile from django.views.generic import TemplateView, View
from work_sell.models import Picture import logging
from projects.models import Order
from chat.models import Documents
from common.models import MainPage, PrintDocuments from common.models import MainPage, PrintDocuments
from projects.models import Order
from users.models import ContractorResumeFiles from users.models import ContractorResumeFiles
from chat.models import Documents
from work_sell.models import Picture from work_sell.models import Picture
class HomeTemplateView(View): class HomeTemplateView(View):
template_name = 'home.html' template_name = 'home.html'

Loading…
Cancel
Save