[extensions-web: 37/75] Use DON'T PANIC, the Werkzeug debugger, if asked politely.
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web: 37/75] Use DON'T PANIC, the Werkzeug debugger, if asked politely.
- Date: Fri, 23 Sep 2011 03:17:32 +0000 (UTC)
commit 17216677cdc2999a736661494d64887173c047f0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Sep 16 18:14:53 2011 -0400
Use DON'T PANIC, the Werkzeug debugger, if asked politely.
etc/sweettooth.wsgi.example | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/etc/sweettooth.wsgi.example b/etc/sweettooth.wsgi.example
index bac4af3..a8174ea 100644
--- a/etc/sweettooth.wsgi.example
+++ b/etc/sweettooth.wsgi.example
@@ -1,3 +1,4 @@
+
import os
import site
import sys
@@ -12,5 +13,26 @@ if os.path.exists(_venv):
sys.path.extend([_path, os.path.join(_path, 'sweettooth')])
+USE_DONT_PANIC = True
+
+def _DONT_PANIC(application):
+ """
+ Try to use DON'T PANIC, your friendly Werkzeug debugger
+ """
+ try:
+ from werkzeug import DebuggedApplication
+ except ImportError:
+ return application
+
+ from django.views import debug
+ def null_technical_500_response(request, exc_type, exc_value, tb):
+ raise exc_type, exc_value, tb
+ debug.technical_500_response = null_technical_500_response
+
+ return DebuggedApplication(application, True)
+
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
+
+if USE_DONT_PANIC:
+ application = _DONT_PANIC(application)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]