gpt4 book ai didi

python - Django:导入错误:没有名为 pocdebug_toolbar 的模块

转载 作者:太空宇宙 更新时间:2023-11-03 19:00:51 26 4
gpt4 key购买 nike

从 uWSGI 启动 Django 时出现此错误,并且无法找出问题所在:

...
File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 160, in _fetch
app = import_module(appname)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named pocdebug_toolbar
Python 2.7.3; Django ==1.4.3; Ubuntu 12.04.2 LTS

Here is the full traceback:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 179, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 221, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info) File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 66, in technical_500_response
html = reporter.get_traceback_html() File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 287, in get_traceback_html
return t.render(c)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 140, in render
return self._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 134, in _render
return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 823, in render
bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 74, in render_node
return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 84, in render
output = self.filter_expression.resolve(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 599, in resolve
new_obj = func(obj, *arg_vals)
File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 718, in date
return format(value, arg)
File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 310, in format
return df.format(format_string)
File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 33, in format
pieces.append(force_unicode(getattr(self, piece)()))
File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 214, in r
return self.format('D, j M Y H:i:s O')
File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 33, in format
pieces.append(force_unicode(getattr(self, piece)()))
File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py", line 71, in force_unicode
s = unicode(s) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 121, in __unicode_cast
return func(*self.__args, **self.__kw) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 86, in ugettext
return _trans.ugettext(message) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 278, in ugettext
return do_translate(message, 'ugettext') File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 268, in do_translate
_default = translation(settings.LANGUAGE_CODE) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 183, in translation
default_translation = _fetch(settings.LANGUAGE_CODE) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 160, in _fetch
app = import_module(appname)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named pocdebug_toolbar

最佳答案

已解决。我忘记了 settings.py INSTALLED_APPS 元组中应用程序之间的逗号,因此它将两个字符串“poc”和“debug_toolbar”连接成“pocdebug_toolbar”。

INSTALLED_APPS = (
...
'poc' # <== missing comma here
'debug_toolbar'
)

关于python - Django:导入错误:没有名为 pocdebug_toolbar 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16096060/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com