“许可被拒绝”在 Django 模板中使用 Djapian
我遵循了 Djapian 教程并“按书本”设置了所有内容,以便 Djapian 提供的 indexshell 命令行显示成功的查询。
然而,当集成 Djapian 教程中的示例搜索时,我收到了这个无意义的错误:
/search/ 处的模板语法错误
渲染时捕获异常:(13,“权限被拒绝”)
它指向这一行:
{% 如果结果 %}
更改或省略该行将在引用“结果”中的字段的任何行处产生下一个(相同)错误。
堆栈跟踪显示此异常:
OSError(13, '权限被拒绝')
在:
render_node 中的/usr/local/lib/python2.6/dist-packages/django/template/debug.py
django-debug-toolbar 中的 /usr/local/lib/python2.6/dist-packages/django/template/debug.py 显示结果:
这是 Djapian 的问题吗?无论如何,为什么会产生“权限被拒绝”错误?
I've followed the Djapian tutorial and setup everything "by the book" so that the indexshell commandline supplied by Djapian shows successful queries.
However, when integrating the sample search from the Djapian tutorial I get this nonsense error:
TemplateSyntaxError at /search/
Caught an exception while rendering: (13, 'Permission denied')
It points to this line:
{% if results %}
Changing or omitting the line will yield the next (same) error at whichever line that references a field from "results".
The stacktrace shows this exception:
OSError(13, 'Permission denied')
in:
/usr/local/lib/python2.6/dist-packages/django/template/debug.py in render_node
django-debug-toolbar shows for results:
<djapian.resultset.ResultSet object at 0x7f7142affcd0>
Is this an issue with Djapian? In any case, why would it yield a "Permission denied" error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请找出该错误所涉及的确切文件路径是什么。我猜它涉及对某些模板缓存的写入操作,但您应该确保。
然后,您只需检查所访问文件的 UNIX 权限,或者检查该文件的目录(如果是新创建的文件)。
另一种可能性是通过
strace
运行您的应用程序(它是一个命令行工具,请参阅man strace
) 并尝试搜索此类错误(13) 在其输出中。它将向您显示问题所涉及的确切路径。Please figure out what is the exact file path involved in this error. I guess it involves a write operation to some template cache, but you should make sure.
Then you just need to check the UNIX permissions on the file accessed or on the directory for that file in the case of a newly created file.
Another possibility is to run your application via
strace
(it is a command line tool, seeman strace
) and try to search for such an error (13) in its output. It'll show you the exact path involved in the problem.