Add PDB on exception debug tool and config setting
This commit is contained in:
@@ -22,6 +22,10 @@ from .utils import validate_path
|
||||
from .links import (password_change_view, current_user_details,
|
||||
current_user_edit, about_view, license_view, admin_site, sentry)
|
||||
from .models import AutoAdminSingleton
|
||||
from .debug import insert_pdb_exception_hook
|
||||
|
||||
if getattr(settings, 'DEBUG_ON_EXCEPTION', False):
|
||||
insert_import_hook()
|
||||
|
||||
bind_links(['about_view', 'license_view'], [about_view, license_view], menu_name='secondary_menu')
|
||||
bind_links(['current_user_details', 'current_user_edit', 'password_change_view'], [current_user_details, current_user_edit, password_change_view], menu_name='secondary_menu')
|
||||
|
||||
16
apps/common/debug.py
Normal file
16
apps/common/debug.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import sys, pdb
|
||||
|
||||
previous_except_hook = None
|
||||
|
||||
|
||||
def except_hook(exctype, value, traceback):
|
||||
if previous_except_hook:
|
||||
previous_except_hook(exctype, value, traceback)
|
||||
|
||||
pdb.post_mortem(traceback)
|
||||
|
||||
|
||||
def insert_pdb_exception_hook():
|
||||
previous_except_hook = sys.excepthook
|
||||
sys.excepthook = except_hook
|
||||
|
||||
Reference in New Issue
Block a user