Apache2突然给了内部500错误

我有一个Ubuntu Server 10.04的虚拟机实例,用mod_wsgi运行django。 它工作正常,然后在做一个/etc/init.d/apache2重新加载和/etc/init.d/apache2重新启动后,我得到什么,但内部500错误。 我检查了日志,当我打到服务器,没有输出。 但是,当服务器重新启动,我得到以下,据我可以告诉是不相关的我的问题。

编辑:刚才意识到我有一个自定义的日志文件,不在通常的地方。 下面是真正的日志文件一直在捕获的东西:

[Mon Jul 19 05:40:10 2010] [info] [client 192.168.1.152] mod_wsgi (pid=1693, process='', application='192.168.1.153|'): Loading WSGI script '/srv/www/mysite.com/application/django.wsgi'. [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] mod_wsgi (pid=1693): Exception occurred processing WSGI script '/srv/www/mysite.com/application/django.wsgi'. [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] Traceback (most recent call last): [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 241, in __call__ [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] response = self.get_response(request) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 142, in get_response [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return self.handle_uncaught_exception(request, resolver, exc_info) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 166, in handle_uncaught_exception [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return debug.technical_500_response(request, *exc_info) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/views/debug.py", line 58, in technical_500_response [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] html = reporter.get_traceback_html() [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/views/debug.py", line 137, in get_traceback_html [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return t.render(c) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py", line 173, in render [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return self._render(context) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py", line 167, in _render [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return self.nodelist.render(context) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py", line 796, in render [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] bits.append(self.render_node(node, context)) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py", line 72, in render_node [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] result = node.render(context) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py", line 89, in render [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] output = self.filter_expression.resolve(context) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py", line 579, in resolve [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] new_obj = func(obj, *arg_vals) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/template/defaultfilters.py", line 693, in date [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return format(value, arg) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/dateformat.py", line 281, in format [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return df.format(format_string) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/dateformat.py", line 30, in format [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] pieces.append(force_unicode(getattr(self, piece)())) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/dateformat.py", line 187, in r [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return self.format('D, j MYH:i:s O') [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/dateformat.py", line 30, in format [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] pieces.append(force_unicode(getattr(self, piece)())) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/encoding.py", line 66, in force_unicode [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] s = unicode(s) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 206, in __unicode_cast [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return self.__func(*self.__args, **self.__kw) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py", line 55, in ugettext [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return real_ugettext(message) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 55, in _curried [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs)) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py", line 36, in delayed_loader [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return getattr(trans, real_name)(*args, **kwargs) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 276, in ugettext [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] return do_translate(message, 'ugettext') [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 266, in do_translate [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] _default = translation(settings.LANGUAGE_CODE) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 176, in translation [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] default_translation = _fetch(settings.LANGUAGE_CODE) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 159, in _fetch [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] app = import_module(appname) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] __import__(name) [Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] TemplateSyntaxError: Caught ImportError while rendering: No module named mysite.website [Mon Jul 19 07:40:11 2010] [debug] mod_deflate.c(615): [client 192.168.1.152] Zlib: Compressed 620 to 383 : URL /admin 

我改变的唯一的东西是在我的Django文件。 我确实更改了urls.py文件

mod_wsgi(pid = 1693):处理WSGI脚本发生exception'/srv/www/mysite.com/application/django.wsgi

回去看看你的变化,然后确认错误日志中显示的错误。 这应该是显而易见的。 您的更改创build了错误。 尝试恢复您修改的django文件…例如urls.py

在你的/etc/apache2/apache2.conf文件中,你可以打开你的日志logging,也许会发现错误。 你应该find这样的部分:

 # # LogLevel: Control the number of messages logged to the error_log. # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. # LogLevel warn 

将其更改为此并尝试并重新启动服务器:

 # # LogLevel: Control the number of messages logged to the error_log. # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. # LogLevel debug