1

我正在使用 Django==1.4.5,Python==2.7.5 并尝试放置像 django-debug-toolbar 这样的分析器。我已遵循文档并在本地设置中应用了以下设置:-

如果调试:INTERNAL_IPS = ('127.0.0.1',) MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)

INSTALLED_APPS += (
    'debug_toolbar',
)

DEBUG_TOOLBAR_PATCH_SETTINGS = False
DEBUG_TOOLBAR_PANELS = [
    'debug_toolbar.panels.versions.VersionsPanel',
    'debug_toolbar.panels.timer.TimerPanel',
    'debug_toolbar.panels.settings.SettingsPanel',
    'debug_toolbar.panels.headers.HeadersPanel',
    'debug_toolbar.panels.request.RequestPanel',
    'debug_toolbar.panels.sql.SQLPanel',
    'debug_toolbar.panels.staticfiles.StaticFilesPanel',
    'debug_toolbar.panels.templates.TemplatesPanel',
    'debug_toolbar.panels.cache.CachePanel',
    'debug_toolbar.panels.signals.SignalsPanel',
    'debug_toolbar.panels.logging.LoggingPanel',
    'debug_toolbar.panels.redirects.RedirectsPanel',
]

DEBUG_TOOLBAR_CONFIG = {
    'INTERCEPT_REDIRECTS': False,
} 

我收到此错误“NoneType”对象没有属性“_meta”

Traceback:
File "/Users/nikhilverma/workspace/BHANE/pyenv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  136.                     response = response.render()
File "/Users/nikhilverma/workspace/BHANE/pyenv/lib/python2.7/site-packages/django/template/response.py" in render
  104.             self._set_content(self.rendered_content)
File "/Users/nikhilverma/workspace/BHANE/pyenv/lib/python2.7/site-packages/django/template/response.py" in rendered_content
  81.         content = template.render(context)
File "/Users/nikhilverma/workspace/BHANE/pyenv/lib/python2.7/site-packages/django/template/base.py" in render
  140.             return self._render(context)
File "/Users/nikhilverma/workspace/BHANE/pyenv/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  61.     template_rendered.send(sender=self, template=self, context=context)
File "/Users/nikhilverma/workspace/BHANE/pyenv/lib/python2.7/site-packages/django/dispatch/dispatcher.py" in send
  172.             response = receiver(signal=self, sender=sender, **named)
File "/Users/nikhilverma/workspace/BHANE/pyenv/lib/python2.7/site-packages/debug_toolbar/panels/templates/panel.py" in _store_template_info
  114.                             value.model._meta.app_label, value.model.__name__)

Exception Type: AttributeError at /
Exception Value: 'NoneType' object has no attribute '_meta'

请指教

4

0 回答 0