Reconfigure various options in the settings.

Add list of allowed hostnames

Add list of admins

Correctly setup logging
This commit is contained in:
Tom Price
2015-04-25 23:27:19 +01:00
parent fa16e7e1a1
commit ee527a4df8

View File

@@ -25,10 +25,14 @@ DEBUG = False
TEMPLATE_DEBUG = True TEMPLATE_DEBUG = True
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['pyrigs.nottinghamtec.co.uk', 'rigs.nottinghamtec.co.uk', 'pyrigs.herokuapp.com']
INTERNAL_IPS = ['127.0.0.1'] INTERNAL_IPS = ['127.0.0.1']
ADMINS = (
('Tom Price', 'tomtom5152@gmail.com')
)
# Application definition # Application definition
@@ -84,7 +88,7 @@ DATABASES = {
} }
} }
if not DEBUG: if False: #not DEBUG:
import dj_database_url import dj_database_url
DATABASES['default'] = dj_database_url.config() DATABASES['default'] = dj_database_url.config()
@@ -112,13 +116,27 @@ LOGGING = {
'level': 'DEBUG', 'level': 'DEBUG',
'class': 'logging.StreamHandler', 'class': 'logging.StreamHandler',
'formatter': 'verbose' 'formatter': 'verbose'
} },
'mail_admins': {
'class': 'django.utils.log.AdminEmailHandler',
'level': 'ERROR',
# But the emails are plain text by default - HTML is nicer
'include_html': True,
},
}, },
'loggers': { 'loggers': {
'RIGS': { # Again, default Django configuration to email unhandled exceptions
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
# Might as well log any errors anywhere else in Django
'django': {
'handlers': ['console'], 'handlers': ['console'],
'level': 'INFO', 'level': 'ERROR',
} 'propagate': False,
},
} }
} }