Browse Source

Redireciona warnings para logging.

pull/3453/head
Leandro Roberto 3 years ago
parent
commit
8a2a69b0fb
  1. 22
      sapl/settings.py

22
sapl/settings.py

@ -22,13 +22,13 @@ from dj_database_url import parse as db_url
from easy_thumbnails.conf import Settings as thumbnail_settings from easy_thumbnails.conf import Settings as thumbnail_settings
from unipath import Path from unipath import Path
logging.captureWarnings(True)
host = socket.gethostbyname_ex(socket.gethostname())[0] host = socket.gethostbyname_ex(socket.gethostname())[0]
BASE_DIR = Path(__file__).ancestor(1) BASE_DIR = Path(__file__).ancestor(1)
PROJECT_DIR = Path(__file__).ancestor(2) PROJECT_DIR = Path(__file__).ancestor(2)
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY', default='') SECRET_KEY = config('SECRET_KEY', default='')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
@ -48,7 +48,6 @@ if DEBUG:
else: else:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# SAPL business apps in dependency order # SAPL business apps in dependency order
SAPL_APPS = ( SAPL_APPS = (
'sapl.audiencia', 'sapl.audiencia',
@ -139,7 +138,7 @@ MIDDLEWARE = [
'whitenoise.middleware.WhiteNoiseMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware',
] ]
if DEBUG: if DEBUG:
INSTALLED_APPS += ('debug_toolbar', ) INSTALLED_APPS += ('debug_toolbar',)
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ] MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ]
INTERNAL_IPS = ('127.0.0.1') INTERNAL_IPS = ('127.0.0.1')
@ -185,7 +184,6 @@ CACHES = {
} }
} }
ROOT_URLCONF = 'sapl.urls' ROOT_URLCONF = 'sapl.urls'
TEMPLATES = [ TEMPLATES = [
@ -212,7 +210,6 @@ TEMPLATES = [
}, },
] ]
WSGI_APPLICATION = 'sapl.wsgi.application' WSGI_APPLICATION = 'sapl.wsgi.application'
# Database # Database
@ -284,7 +281,7 @@ WEBPACK_LOADER = {
'DEFAULT': { 'DEFAULT': {
'CACHE': not DEBUG, 'CACHE': not DEBUG,
'BUNDLE_DIR_NAME': 'sapl/static/sapl/frontend', 'BUNDLE_DIR_NAME': 'sapl/static/sapl/frontend',
'STATS_FILE': PROJECT_DIR.child('frontend').child(f'{"dev-" if DEBUG else ""}webpack-stats.json'), 'STATS_FILE': PROJECT_DIR.child('frontend').child(f'{"dev-" if DEBUG else ""}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']
@ -294,7 +291,6 @@ if DEBUG and not WEBPACK_LOADER['DEFAULT']['STATS_FILE'].exists():
WEBPACK_LOADER['DEFAULT']['STATS_FILE'] = PROJECT_DIR.child( WEBPACK_LOADER['DEFAULT']['STATS_FILE'] = PROJECT_DIR.child(
'frontend').child(f'webpack-stats.json') 'frontend').child(f'webpack-stats.json')
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = PROJECT_DIR.child("collected_static") STATIC_ROOT = PROJECT_DIR.child("collected_static")
@ -327,6 +323,7 @@ FILTERS_HELP_TEXT_FILTER = False
LOGGING = { LOGGING = {
'version': 1, 'version': 1,
'disable_existing_loggers': False, 'disable_existing_loggers': False,
'formatters': { 'formatters': {
'verbose': { 'verbose': {
'format': '%(levelname)s %(asctime)s ' + host + ' %(pathname)s %(name)s:%(funcName)s:%(lineno)d %(message)s' 'format': '%(levelname)s %(asctime)s ' + host + ' %(pathname)s %(name)s:%(funcName)s:%(lineno)d %(message)s'
@ -369,15 +366,4 @@ PASSWORD_HASHERS = [
'sapl.hashers.ZopeSHA1PasswordHasher', 'sapl.hashers.ZopeSHA1PasswordHasher',
] ]
def remove_warnings():
import warnings
warnings.filterwarnings(
'ignore', module='floppyforms',
message='Unable to import floppyforms.gis'
)
LOGOUT_REDIRECT_URL = '/login' LOGOUT_REDIRECT_URL = '/login'
remove_warnings()

Loading…
Cancel
Save