Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 是什么导致Django在6次使用500.html中只使用了3次?_Python_Django - Fatal编程技术网

Python 是什么导致Django在6次使用500.html中只使用了3次?

Python 是什么导致Django在6次使用500.html中只使用了3次?,python,django,Python,Django,这很奇怪 我在下面有一个500.html模板。当我通过url引用一个不存在的页面时,my 500.html将显示三次(如果我反复尝试重新加载该页面),然后三次出现apache内部服务器错误。我的兄弟总是在两者之间摇摆不定 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head>

这很奇怪

我在下面有一个500.html模板。当我通过url引用一个不存在的页面时,my 500.html将显示三次(如果我反复尝试重新加载该页面),然后三次出现apache内部服务器错误。我的兄弟总是在两者之间摇摆不定

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
    <title>Page unavailable</title>
</head>
<body>
    <h1>Page unavailable</h1>
    <p>Sorry, but the requested page is unavailable due to a
    server hiccup.</p>
    <p>Our engineers have been notified, so check back later.</p>
</body>
</html>

我会尝试重新启动apache。我注意到URL在任何更改后的处理方式都不一致。这听起来很像我在刷新时加载url时遇到的问题。

你能显示错误日志的摘录吗?你确定它说
500.html
不存在吗?如果您访问的页面与URL不匹配,则应该会出现
404
错误。如果您尚未定义
404.html
模板,则将生成一个
500
,其中包含一条“404模板找不到”的消息。它与url匹配,但没有模板。我以为我已重新启动了它。我想不是。这把它修好了。谢谢
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1] mod_python (pid=8262, interpreter='127.0.1.1', phase='PythonHandler', handler='django.core.handlers.modpython'): Application error
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1] ServerName: '127.0.1.1'
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1] DocumentRoot: '/var/www'
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1] URI: '/test'
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1] Location: '/test'
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1] Directory: None
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1] Filename: '/www/test/wsgi.py'
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1] PathInfo: ''
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1] Traceback (most recent call last):
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch\n    default=default_handler, arg=req, silent=hlist.silent)
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1229, in _process_target\n    result = _execute_target(config, req, object, arg)
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1128, in _execute_target\n    result = object(arg)
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/modpython.py", line 180, in handler\n    return ModPythonHandler()(req)
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/modpython.py", line 158, in __call__\n    response = self.get_response(request)
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 153, in get_response\n    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 228, in handle_uncaught_exception\n    return callback(request, **param_dict)
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py", line 91, in _wrapped_view\n    response = view_func(request, *args, **kwargs)
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/django/views/defaults.py", line 32, in server_error\n    t = loader.get_template(template_name) # You need to create a 500.html template.
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/django/template/loader.py", line 145, in get_template\n    template, origin = find_template(template_name)
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1]   File "/usr/lib/python2.7/dist-packages/django/template/loader.py", line 138, in find_template\n    raise TemplateDoesNotExist(name)
[Tue Mar 05 22:28:22 2013] [error] [client 127.0.0.1] TemplateDoesNotExist: 500.html