我正在webfaction服务器上使用Wagtail CMS部署站点。当我尝试访问www.mysite.com/admin(wagatil admin interfase)时,它会给我一个500错误。我可以毫无问题地去django的管理员。
我查看了服务器日志,它说的是它为'request'键引发了KeyError。仅当Debug为True时才会发生这种情况,我将其更改为False并正确呈现/ admin。
我确认在'django.core.context_processors.request'
设置中添加了TEMPLATE_CONTEXT_PROCESSORS
。
这是服务器日志的回溯
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] mod_wsgi (pid=21360): Exception occurred processing WSGI script '/home/frodriguez/webapps/djblog/myproject/myproject/wsgi.py'.
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] Traceback (most recent call last):
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 206, in __call__
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] response = self.get_response(request)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 194, in get_response
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 236, in handle_uncaught_exception
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] return callback(request, **param_dict)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] response = view_func(request, *args, **kwargs)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/views/defaults.py", line 46, in server_error
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] return http.HttpResponseServerError(template.render(Context({})))
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/template/base.py", line 140, in render
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] return self._render(context)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/template/base.py", line 134, in _render
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] return self.nodelist.render(context)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/template/base.py", line 840, in render
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] bit = self.render_node(node, context)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/template/base.py", line 854, in render_node
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] return node.render(context)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/template/loader_tags.py", line 123, in render
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] return compiled_parent._render(context)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/template/base.py", line 134, in _render
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] return self.nodelist.render(context)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/template/base.py", line 840, in render
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] bit = self.render_node(node, context)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/template/base.py", line 854, in render_node
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] return node.render(context)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/template/base.py", line 1125, in render
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] return func(*resolved_args, **resolved_kwargs)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/wagtail/wagtailadmin/templatetags/wagtailuserbar.py", line 15, in wagtailuserbar
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] request = context['request']
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] File "/home/frodriguez/.virtualenvs/venv/lib/python2.7/site-packages/django/template/context.py", line 56, in __getitem__
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] raise KeyError(key)
[Fri Nov 07 15:33:58 2014] [error] [client 127.0.0.1] KeyError: 'request'
有谁知道我错过了什么?
答案 0 :(得分:3)
如果有人遇到这个问题,我会自己回答。
这是一个由两部分组成的问题。
1-)我在500.html模板中从base.html扩展。
除去那个显示真正的错误,即压缩应用程序没有压缩文件,所以你必须做以下
2。)运行python manage.py compress --force
在该管理站点使用DEBUG = False进行渲染后没有问题。