使用linux mod_wsgi的Django部署问题

时间:2013-04-10 01:34:22

标签: python django apache mod-wsgi

在Linux服务器上部署我的django应用程序后,我发现错误 -

[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229] mod_wsgi (pid=20033): Exception occurred processing WSGI script '/var/www/html/appletrade/django.wsgi'.
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229] Traceback (most recent call last):
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]   File "usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 272, in __call__
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]     response = self.get_response(request)
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]   File "usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 169, in get_response
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]   File "usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 218, in handle_uncaught_exception
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]     return callback(request, **param_dict)
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]   File "usr/lib/python2.6/site-packages/django/utils/decorators.py", line 93, in _wrapped_view
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]     response = view_func(request, *args, **kwargs)
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]   File "usr/lib/python2.6/site-packages/django/views/defaults.py", line 30, in server_error
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]     t = loader.get_template(template_name) # You need to create a 500.html template.
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]   File "usr/lib/python2.6/site-packages/django/template/loader.py", line 157, in get_template
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]     template, origin = find_template(template_name)
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]   File "usr/lib/python2.6/site-packages/django/template/loader.py", line 138, in find_template
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229]     raise TemplateDoesNotExist(name)
[Wed Apr 10 05:21:52 2013] [error] [client 117.199.125.229] TemplateDoesNotExist: 500.html

我无法得到我错过的配置。请帮我。

如果需要有关配置的更多信息,请与我们联系。

1 个答案:

答案 0 :(得分:1)

在debug = False上部署Django。您必须在其中一个模板路径中包含500.html模板。您只需创建一个名为500.html

的空文件即可

文档中的更多信息:

https://docs.djangoproject.com/en/dev/topics/http/views/#the-500-server-error-view