加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

难以安装Django调试工具栏

发布时间:2020-12-20 12:23:56 所属栏目:Python 来源:网络整理
导读:我试图安装Django Panels并遇到错误.我使用pip -pip install django-debug-toolbar安装 – 它似乎没问题.但是当我将它添加到我的项目中时: INSTALLED_APPS = ( 'django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.con
我试图安装Django Panels并遇到错误.我使用pip -pip install django-debug-toolbar安装 – 它似乎没问题.但是当我将它添加到我的项目中时:

INSTALLED_APPS = (
    'django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.staticfiles','django.contrib.sites','django.contrib.admin','django.contrib.flatpages','coltrane','markdown','debug_toolbar',)

然后运行python manage.py syncdb得到以下错误:

python manage.py syncdb
Traceback (most recent call last):
  File "manage.py",line 10,in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Django-1.7.dev20140121103749-py2.7.egg/django/core/management/__init__.py",line 427,in execute_from_command_line
    utility.execute()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Django-1.7.dev20140121103749-py2.7.egg/django/core/management/__init__.py",line 391,in execute
    django.setup()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Django-1.7.dev20140121103749-py2.7.egg/django/__init__.py",line 21,in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Django-1.7.dev20140121103749-py2.7.egg/django/apps/registry.py",line 105,in populate
    app_config.import_models(all_models)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Django-1.7.dev20140121103749-py2.7.egg/django/apps/base.py",line 160,in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",line 37,in import_module
    __import__(name)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/debug_toolbar/models.py",in <module>
    from debug_toolbar.middleware import DebugToolbarMiddleware
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/debug_toolbar/middleware.py",line 13,in <module>
    from debug_toolbar.toolbar import DebugToolbar
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/debug_toolbar/toolbar.py",line 153,in <module>
    urlpatterns = DebugToolbar.get_urls()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/debug_toolbar/toolbar.py",line 147,in get_urls
    for panel_class in cls.get_panel_classes():
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/debug_toolbar/toolbar.py",line 125,in get_panel_classes
    (panel_module,e))
django.core.exceptions.ImproperlyConfigured: Error importing debug panel debug_toolbar.panels.signals: "cannot import name WEAKREF_TYPES"

我一直在寻找答案,但没有运气.有谁知道这里可能有什么问题?任何帮助将不胜感激.

解决方法

您正在使用django Django-1.7.dev20140121103749的开发版本,该版本仅用于测试而非用于生产用途.这就是导入无效的原因.

您需要使用最新版本的django,即1.6.1

请下载正确的版本.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读