2013-04-19 94 views
1

從uWSGI開始Django的時候,並不能找出什麼是錯的,我得到這個錯誤:Django的:導入錯誤:沒有模塊名爲pocdebug_toolbar

... 
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 
+0

這是一個很難回答的問題,因爲您已經對它進行了構建。我們不知道你的系統上安裝了什麼軟件包,你的路徑是什麼,你如何安裝你正在使用的軟件包......如果你只是這麼說,我們就幫不了你。此外,我認爲還有另一個堆棧交換站點更適合這種問題(http://stackexchange.com/sites),可能是Ask Ubuntu,服務器故障或超級用戶。 – mattg

+1

你的'INSTALLED_APPS'包含什麼?好像你有'pocdebug_toolbar'列出而不是'debug_toolbar'。 –

+0

你釘了它 - 謝謝@Austin_Phillips!我忘記INSTALLED_APPS元組中的兩個應用程序之間的逗號,所以字符串被連接起來。 –

回答

1

已解決。我在settings.pyINSTALLED_APPS元組中忘記了我的應用程序之間的逗號,因此它將兩個字符串的'poc'和'debug_toolbar'連接到'pocdebug_toolbar'中。

INSTALLED_APPS = (
    ... 
    'poc' # <== missing comma here 
    'debug_toolbar' 
    ) 
相關問題