2012-04-25 76 views
0

我在我的Django項目上使用Haystack,並且所有的工作都很好地使用了django服務器。當我要在Apache上運行時,我收到錯誤500;更精確地從日誌:Django mod_wsgi和haystack = error 500

mod_wsgi (pid=4536): Exception occurred processing WSGI script 

'/opt/local/apache2/htdocs/meishi/meishi/wsgi.py'. 
Traceback (most recent call last): 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/core/handlers/wsgi.py", line 241, in __call__ 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  response = self.get_response(request) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/core/handlers/base.py", line 179, in get_response 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/core/handlers/base.py", line 221, in handle_uncaught_exception 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return debug.technical_500_response(request, *exc_info) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/views/debug.py", line 66, in technical_500_response 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  html = reporter.get_traceback_html() 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/views/debug.py", line 276, in get_traceback_html 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return t.render(c) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/template/base.py", line 140, in render 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return self._render(context) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/template/base.py", line 134, in _render 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return self.nodelist.render(context) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/template/base.py", line 823, in render 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  bit = self.render_node(node, context) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/template/debug.py", line 74, in render_node 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return node.render(context) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/template/debug.py", line 84, in render 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  output = self.filter_expression.resolve(context) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/template/base.py", line 599, in resolve 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  new_obj = func(obj, *arg_vals) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/template/defaultfilters.py", line 718, in date 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return format(value, arg) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/dateformat.py", line 310, in format 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return df.format(format_string) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/dateformat.py", line 33, in format 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  pieces.append(force_unicode(getattr(self, piece)())) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/dateformat.py", line 214, in r 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return self.format('D, j M Y H:i:s O') 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/dateformat.py", line 33, in format 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  pieces.append(force_unicode(getattr(self, piece)())) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/encoding.py", line 71, in force_unicode 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  s = unicode(s) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/functional.py", line 121, in __unicode_cast 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return func(*self.__args, **self.__kw) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/translation/__init__.py", line 86, in ugettext 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return _trans.ugettext(message) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/translation/trans_real.py", line 278, in ugettext 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  return do_translate(message, 'ugettext') 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/translation/trans_real.py", line 268, in do_translate 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  _default = translation(settings.LANGUAGE_CODE) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/translation/trans_real.py", line 183, in translation 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  default_translation = _fetch(settings.LANGUAGE_CODE) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/translation/trans_real.py", line 160, in _fetch 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  app = import_module(appname) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File "/Applications/MAMP/htdocs/Django-1.4/django/utils/importlib.py", line 35, in import_module 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1]  __import__(name) 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] ImportError: No module named haystack 
[Wed Apr 25 13:41:52 2012] [error] [client 127.0.0.1] File does not exist: /opt/local/apache2/htdocs/favicon.ico 

在我的項目中使用草垛之前,我沒有任何問題,在所有的mod_wsgi,一切運作良好。 可能是什麼問題?

+0

從錯誤日誌中提供實際的回溯和異常消息,而不僅僅是之前的一行消息。 – 2012-04-25 21:08:55

+0

添加完整的錯誤日誌! – 2012-04-25 21:11:50

回答

2

錯誤表明'haystack'模塊未安裝到mod_wsgi正在使用的Python安裝中。確定安裝'haystack'模塊的位置,並確保它與mod_wsgi使用的是相同的Python安裝。

+0

我有同樣的問題,並且知道錯誤的含義肯定有助於解決問題。礦是一個愚蠢的錯誤,我沒有激活我的虛擬環境,乾草堆安裝。 – 2017-02-24 04:06:45