让人惊讶。尝试使用mod_wsgi在Apache上运行我的Django应用程序。遇到这么多错误。这是我无法弄清楚的最新内容:
[Fri Apr 22 23:21:31 2011] [error] [client ::1] mod_wsgi (pid=23999): Exception occurred processing WSGI script '/Users/kevin/PycharmProjects/ml/apache/django.wsgi'.
[Fri Apr 22 23:21:31 2011] [error] [client ::1] Traceback (most recent call last):
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/core/handlers/wsgi.py", line 273, in __call__
[Fri Apr 22 23:21:31 2011] [error] [client ::1] response = self.get_response(request)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/core/handlers/base.py", line 169, in get_response
[Fri Apr 22 23:21:31 2011] [error] [client ::1] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/core/handlers/base.py", line 203, in handle_uncaught_exception
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return debug.technical_500_response(request, *exc_info)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/views/debug.py", line 59, in technical_500_response
[Fri Apr 22 23:21:31 2011] [error] [client ::1] html = reporter.get_traceback_html()
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/views/debug.py", line 151, in get_traceback_html
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return t.render(c)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/template/base.py", line 123, in render
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return self._render(context)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/template/base.py", line 117, in _render
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return self.nodelist.render(context)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/template/base.py", line 744, in render
[Fri Apr 22 23:21:31 2011] [error] [client ::1] bits.append(self.render_node(node, context))
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/template/debug.py", line 73, in render_node
[Fri Apr 22 23:21:31 2011] [error] [client ::1] result = node.render(context)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/template/debug.py", line 90, in render
[Fri Apr 22 23:21:31 2011] [error] [client ::1] output = self.filter_expression.resolve(context)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/template/base.py", line 536, in resolve
[Fri Apr 22 23:21:31 2011] [error] [client ::1] new_obj = func(obj, *arg_vals)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/template/defaultfilters.py", line 695, in date
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return format(value, arg)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/dateformat.py", line 285, in format
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return df.format(format_string)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/dateformat.py", line 30, in format
[Fri Apr 22 23:21:31 2011] [error] [client ::1] pieces.append(force_unicode(getattr(self, piece)()))
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/dateformat.py", line 191, in r
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return self.format('D, j M Y H:i:s O')
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/dateformat.py", line 30, in format
[Fri Apr 22 23:21:31 2011] [error] [client ::1] pieces.append(force_unicode(getattr(self, piece)()))
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/encoding.py", line 71, in force_unicode
[Fri Apr 22 23:21:31 2011] [error] [client ::1] s = unicode(s)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/functional.py", line 206, in __unicode_cast
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return self.__func(*self.__args, **self.__kw)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/translation/__init__.py", line 81, in ugettext
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return _trans.ugettext(message)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/translation/trans_real.py", line 286, in ugettext
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return do_translate(message, 'ugettext')
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/translation/trans_real.py", line 276, in do_translate
[Fri Apr 22 23:21:31 2011] [error] [client ::1] _default = translation(settings.LANGUAGE_CODE)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/translation/trans_real.py", line 185, in translation
[Fri Apr 22 23:21:31 2011] [error] [client ::1] default_translation = _fetch(settings.LANGUAGE_CODE)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/translation/trans_real.py", line 162, in _fetch
[Fri Apr 22 23:21:31 2011] [error] [client ::1] app = import_module(appname)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/importlib.py", line 35, in import_module
[Fri Apr 22 23:21:31 2011] [error] [client ::1] __import__(name)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/haystack/__init__.py", line 154, in <module>
[Fri Apr 22 23:21:31 2011] [error] [client ::1] handle_registrations()
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/haystack/__init__.py", line 151, in handle_registrations
[Fri Apr 22 23:21:31 2011] [error] [client ::1] search_sites_conf = importlib.import_module(settings.HAYSTACK_SITECONF)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Library/Python/2.6/site-packages/django/utils/importlib.py", line 35, in import_module
[Fri Apr 22 23:21:31 2011] [error] [client ::1] __import__(name)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Users/kevin/PycharmProjects/mg/../mg/search_sites.py", line 1, in <module>
[Fri Apr 22 23:21:31 2011] [error] [client ::1] import haystack
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Users/kevin/PycharmProjects/mg/haystack/__init__.py", line 154, in <module>
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/Users/kevin/PycharmProjects/mg/haystack/__init__.py", line 143, in handle_registrations
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 955, in stack
[Fri Apr 22 23:21:31 2011] [error] [client ::1] return getouterframes(sys._getframe(1), context)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 936, in getouterframes
[Fri Apr 22 23:21:31 2011] [error] [client ::1] framelist.append((frame,) + getframeinfo(frame, context))
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 911, in getframeinfo
[Fri Apr 22 23:21:31 2011] [error] [client ::1] lines, lnum = findsource(frame)
[Fri Apr 22 23:21:31 2011] [error] [client ::1] File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 573, in findsource
[Fri Apr 22 23:21:31 2011] [error] [client ::1] if pat.match(lines[lnum]): break
[Fri Apr 22 23:21:31 2011] [error] [client ::1] TemplateSyntaxError: Caught IndexError while rendering: list index out of range
有一件事很奇怪,我不知道为什么PycharmProjects/mg
被提及。我的项目过去住在'mg'文件夹下,但我很久以前就将它改为'ml'。我当然没有开发服务器的麻烦。我读了另一个关于将mod_wsgi更改为Daemon作为解决方案的SO线程,但这对我不起作用。
谢谢。
答案 0 :(得分:0)
我认为错误的wsgi文件是原因。检查您的Apache站点文件。
WSGIScriptAlias /path/to/your/wsgi