500 debugging...

This commit is contained in:
fergalmoran
2013-06-15 22:10:44 +01:00
parent 53bb1fc25b
commit 78f498c96e
5 changed files with 19 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ ADMINS = (
MANAGERS = ADMINS
AUTH_PROFILE_MODULE = 'spa.UserProfile'
ALLOWED_HOSTS = localsettings.ALLOWED_HOSTS if hasattr(localsettings, 'ALLOWED_HOSTS') else []
ALLOWED_HOSTS = ['*'] #localsettings.ALLOWED_HOSTS if hasattr(localsettings, 'ALLOWED_HOSTS') else []
DATABASES = {
'mysql': {
'ENGINE': 'django.db.backends.mysql',
@@ -52,7 +52,7 @@ USE_TZ = True
SITE_ROOT = here('')
MEDIA_ROOT = localsettings.MEDIA_ROOT
STATIC_ROOT = here('static') #localsettings.STATIC_ROOT if hasattr(localsettings, 'STATIC_ROOT') else ''
STATIC_ROOT = '/var/www/deepsouthsounds.com/static' # here('static') #localsettings.STATIC_ROOT if hasattr(localsettings, 'STATIC_ROOT') else ''
CACHE_ROOT = localsettings.CACHE_ROOT
if DEBUG:

View File

@@ -25,6 +25,7 @@ urlpatterns = patterns('',
(r'^tinymce/', include('tinymce.urls')),
url(r'^', include('spa.urls')),
)
handler500 = 'spa.views.debug_500'
if settings.DEBUG:
from django.views.static import serve

View File

@@ -39,3 +39,5 @@ urlpatterns = patterns(
url(r'^comments/', include('django.contrib.comments.urls')),
(r'^.*/$', 'spa.views.default')
)

View File

@@ -33,3 +33,16 @@ def default(request):
def upload(request):
return render_to_response("inc/upload.html", context_instance=RequestContext(request))
def debug_500(request, template_name='debug_500.html'):
"""
500 error handler.
Templates: `500.html`
Context: sys.exc_info() results
"""
t = loader.get_template(template_name) # You need to create a 500.html template.
ltype,lvalue,ltraceback = sys.exc_info()
sys.exc_clear() #for fun, and to point out I only -think- this hasn't happened at
#this point in the process already
return http.HttpResponseServerError(t.render(Context({'type':ltype,'value':lvalue,'traceback':ltraceback})))

View File

@@ -16,4 +16,4 @@
</div>
</div>
</body>
</html>
</html>