gpt4 book ai didi

python - Wagtail:部署问题 -/admin 上的 KeyError 'request'

转载 作者:行者123 更新时间:2023-11-30 23:18:17 25 4
gpt4 key购买 nike

我正在 webfaction 服务器上使用 Wagtail CMS 部署网站。当我尝试访问 www.mysite.com/admin(wagatil 管理界面)时,它给我一个 500 错误。我可以毫无问题地访问 django 的管理员。

我查看了服务器日志,它说的是它为“请求”键引发了一个 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'

有人知道我错过了什么吗?

最佳答案

以防万一有人遇到这个问题,我自己回答。

这是一个由两部分组成的问题。

1-) 我从 500.html 模板中的 base.html 进行扩展。

删除它之后向我展示了真正的错误,即压缩应用程序没有压缩文件,因此您必须执行以下操作

2.) 运行python manage.py compress --force

之后,管理网站使用 DEBUG=False 进行渲染,没有任何问题。

关于python - Wagtail:部署问题 -/admin 上的 KeyError 'request',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26810855/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com