django-debug-toolbar:'list'不支持缓冲区接口

时间:2014-06-08 16:28:54

标签: django django-debug-toolbar

我对我的模型进行了一些修改,添加了一些图像字段并安装了Pillow,删除了一些模型或模型字段。

由于Site还没有投入生产,我只是删除了数据库并重新创建它,然后同步它。然后我收到了这个错误。

我无法弄清楚这突如其来的错误可能是什么原因。在settings.py中,我添加了一个media_root但没有别的。

Environment:


Request Method: GET
Request URL: http://localhost:8000/

Django Version: 1.6.2
Python Version: 3.4.0
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'backoffice',
 'public',
 'django.contrib.sites',
 'allauth',
 'allauth.account',
 'allauth.socialaccount',
 'allauth.socialaccount.providers.facebook',
 'allauth.socialaccount.providers.google',
 'allauth.socialaccount.providers.twitter',
 'widget_tweaks',
 'rosetta',
 'debug_toolbar',
 'template_debug')
Installed Middleware:
('debug_toolbar.middleware.DebugToolbarMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Template error:
In template C:\Python34\lib\site-packages\debug_toolbar\templates\debug_toolbar\base.html, error at line 5
   'list' does not support the buffer interface
   1 : {% load i18n %}{% load static from staticfiles %}{% load url from future %}


   2 : <style type="text/css">


   3 : @media print { #djDebug {display:none;}}


   4 : </style>


   5 : <link rel="stylesheet" href=" {% static 'debug_toolbar/css/toolbar.css' %} " type="text/css" />


   6 : {% if toolbar.config.JQUERY_URL %}


   7 : <script src="{{ toolbar.config.JQUERY_URL }}"></script>


   8 : <script>var djdt = {jQuery: jQuery.noConflict(true)};</script>


   9 : {% else %}


   10 : <script>var djdt = {jQuery: jQuery};</script>


   11 : {% endif %}


   12 : <script src="{% static 'debug_toolbar/js/toolbar.js' %}"></script>


   13 : <div id="djDebug" style="display:none;" dir="ltr"


   14 :      data-store-id="{{ toolbar.store_id }}" data-render-panel-url="{% url 'djdt:render_panel' %}"


   15 :      {{ toolbar.config.ROOT_TAG_EXTRA_ATTRS|safe }}>


Traceback:
File "C:\Python34\lib\site-packages\django\core\handlers\base.py" in get_response
  201.                 response = middleware_method(request, response)
File "C:\Python34\lib\site-packages\debug_toolbar\middleware.py" in process_response
  121.             bits[-2] += toolbar.render_toolbar()
File "C:\Python34\lib\site-packages\debug_toolbar\toolbar.py" in render_toolbar
  68.             return render_to_string('debug_toolbar/base.html', context)
File "C:\Python34\lib\site-packages\django\template\loader.py" in render_to_string
  164.         return t.render(Context(dictionary))
File "C:\Python34\lib\site-packages\django\template\base.py" in render
  140.             return self._render(context)
File "C:\Python34\lib\site-packages\django\test\utils.py" in instrumented_test_render
  85.     return self.nodelist.render(context)
File "C:\Python34\lib\site-packages\django\template\base.py" in render
  840.                 bit = self.render_node(node, context)
File "C:\Python34\lib\site-packages\django\template\debug.py" in render_node
  78.             return node.render(context)
File "C:\Python34\lib\site-packages\django\templatetags\static.py" in render
  106.         url = self.url(context)
File "C:\Python34\lib\site-packages\django\contrib\staticfiles\templatetags\staticfiles.py" in url
  12.         return staticfiles_storage.url(path)
File "C:\Python34\lib\site-packages\django\utils\functional.py" in inner
  213.             self._setup()
File "C:\Python34\lib\site-packages\django\contrib\staticfiles\storage.py" in _setup
  311.         self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
File "C:\Python34\lib\site-packages\django\contrib\staticfiles\storage.py" in __init__
  37.                                                  *args, **kwargs)
File "C:\Python34\lib\site-packages\django\core\files\storage.py" in __init__
  154.         self.location = abspathu(self.base_location)
File "C:\Python34\lib\ntpath.py" in abspath
  545.                 path = _getfullpathname(path)

Exception Type: TypeError at /
Exception Value: 'list' does not support the buffer interface

1 个答案:

答案 0 :(得分:1)

好吧,我的错。错误实际上非常明确。

与TEMPLATE_DIRS不同,MEDIA_ROOT不应该是列表。

Django Debug toolbar will return an error every time you mess up with variables types in
the "settings.py" file.

如果有人犯了类似的错误,我会在这里离开Q&amp; A.