使用django_debug_tolbar

下载地址:https://github.com/dcramer/django-debug-toolbar

解压

安装:

python setup.py install

配置:

settings.py:

MIDDLEWARE_CLASSES = (
    ...
    'debug_toolbar.middleware.DebugToolbarMiddleware',
)

INSTALLED_APPS = (
    ...
    'debug_toolbar'
)


TEMPLATE_DIRS = (   
    '/Library/Python/2.6/site-packages/django_debug_toolbar-0.8.3-py2.6.egg/debug_toolbar/templates/', #debug_toolbar 的模板目录。
)

DEBUG_TOOLBAR_PANELS = (
             'debug_toolbar.panels.version.VersionDebugPanel',
             'debug_toolbar.panels.timer.TimerDebugPanel',
             'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
             'debug_toolbar.panels.headers.HeaderDebugPanel',
             'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
             'debug_toolbar.panels.template.TemplateDebugPanel',
             'debug_toolbar.panels.sql.SQLDebugPanel',
             'debug_toolbar.panels.signals.SignalDebugPanel',
             'debug_toolbar.panels.logger.LoggingPanel'
  )

INTERNAL_IPS = ('127.0.0.1',)      # 从哪些ip访问站点时显示toolbar.

DATABASE_ENGINE = 'mysql'
 

 

你可能感兴趣的:(django,python)