渲染时出现 TemplateSyntaxError / Caught IOError:(13,“权限被拒绝”)

发布于 2024-11-06 05:11:24 字数 4389 浏览 0 评论 0原文

页面上显示的这个错误

TracebackFile 
"/usr/local/lib64/python2.6/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args,      **callback_kwargs)
File "/usr/local/lib64/python2.6/site-packages/django/views/generic/simple.py" in direct_to_template
  28.     return HttpResponse(t.render(c), mimetype=mimetype)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render
  123.             return self._render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in _render
  117.         return self.nodelist.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render
  744.                 bits.append(self.render_node(node, context))
File "/usr/local/lib64/python2.6/site-packages/django/template/debug.py" in render_node
  73.             result = node.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/loader_tags.py" in render
  127.         return compiled_parent._render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in _render
  117.         return self.nodelist.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render
  744.                 bits.append(self.render_node(node, context))
File "/usr/local/lib64/python2.6/site-packages/django/template/debug.py" in render_node
  73.             result = node.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/loader_tags.py" in render
  64.             result = block.nodelist.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render
  744.                 bits.append(self.render_node(node, context))
File "/usr/local/lib64/python2.6/site-packages/django/template/debug.py" in render_node
  73.             result = node.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/defaulttags.py" in render
  313.             return self.nodelist_false.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render
  744.                 bits.append(self.render_node(node, context))
File "/usr/local/lib64/python2.6/site-packages/django/template/debug.py" in render_node
  73.             result = node.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/defaulttags.py" in render
  437.             url = reverse(view_name, args=args, kwargs=kwargs, current_app=context.current_app)
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in reverse
  391.             *args, **kwargs)))
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in reverse
  312.         possibilities = self.reverse_dict.getlist(lookup_view)
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in _get_reverse_dict
  229.             self._populate()
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in _populate
  208.                     for name in pattern.reverse_dict:
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in _get_reverse_dict
  229.             self._populate()
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in _populate
  220.                 lookups.appendlist(pattern.callback, (bits, p_pattern))
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in _get_callback
  164.             self._callback = get_callable(self._callback_str)
File "/usr/local/lib64/python2.6/site-packages/django/utils/functional.py" in wrapper
  124.         result = func(*args)
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in get_callable
  91.                 lookup_view = getattr(import_module(mod_name), func_name)
File "/usr/local/lib64/python2.6/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)

File "/usr/lib64/python2.6/logging/__init__.py" in __init__
  790.             stream = self._open()
File "/usr/lib64/python2.6/logging/__init__.py" in _open
  810.             stream = open(self.baseFilename, self.mode)

Exception Type: TemplateSyntaxError at /
Exception Value: Caught IOError while rendering: (13, 'Permission denied')

是什么意思?我该如何解决它?

This is the error shown on the page

TracebackFile 
"/usr/local/lib64/python2.6/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args,      **callback_kwargs)
File "/usr/local/lib64/python2.6/site-packages/django/views/generic/simple.py" in direct_to_template
  28.     return HttpResponse(t.render(c), mimetype=mimetype)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render
  123.             return self._render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in _render
  117.         return self.nodelist.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render
  744.                 bits.append(self.render_node(node, context))
File "/usr/local/lib64/python2.6/site-packages/django/template/debug.py" in render_node
  73.             result = node.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/loader_tags.py" in render
  127.         return compiled_parent._render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in _render
  117.         return self.nodelist.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render
  744.                 bits.append(self.render_node(node, context))
File "/usr/local/lib64/python2.6/site-packages/django/template/debug.py" in render_node
  73.             result = node.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/loader_tags.py" in render
  64.             result = block.nodelist.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render
  744.                 bits.append(self.render_node(node, context))
File "/usr/local/lib64/python2.6/site-packages/django/template/debug.py" in render_node
  73.             result = node.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/defaulttags.py" in render
  313.             return self.nodelist_false.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render
  744.                 bits.append(self.render_node(node, context))
File "/usr/local/lib64/python2.6/site-packages/django/template/debug.py" in render_node
  73.             result = node.render(context)
File "/usr/local/lib64/python2.6/site-packages/django/template/defaulttags.py" in render
  437.             url = reverse(view_name, args=args, kwargs=kwargs, current_app=context.current_app)
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in reverse
  391.             *args, **kwargs)))
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in reverse
  312.         possibilities = self.reverse_dict.getlist(lookup_view)
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in _get_reverse_dict
  229.             self._populate()
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in _populate
  208.                     for name in pattern.reverse_dict:
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in _get_reverse_dict
  229.             self._populate()
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in _populate
  220.                 lookups.appendlist(pattern.callback, (bits, p_pattern))
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in _get_callback
  164.             self._callback = get_callable(self._callback_str)
File "/usr/local/lib64/python2.6/site-packages/django/utils/functional.py" in wrapper
  124.         result = func(*args)
File "/usr/local/lib64/python2.6/site-packages/django/core/urlresolvers.py" in get_callable
  91.                 lookup_view = getattr(import_module(mod_name), func_name)
File "/usr/local/lib64/python2.6/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)

File "/usr/lib64/python2.6/logging/__init__.py" in __init__
  790.             stream = self._open()
File "/usr/lib64/python2.6/logging/__init__.py" in _open
  810.             stream = open(self.baseFilename, self.mode)

Exception Type: TemplateSyntaxError at /
Exception Value: Caught IOError while rendering: (13, 'Permission denied')

What does it mean? how can i solve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

墨洒年华 2024-11-13 05:11:24

时出现文件权限问题

通常,这可能是在将do chmod 777 -R 渲染到模板目录

。或者你升级了 django 版本吗?

Normally this could be the file permission problem while rendering

do chmod 777 -R to your template directory.

Or Did you upgraded your django version?

惜醉颜 2024-11-13 05:11:24

运行 Apache 的用户没有写入 /tmp/ 目录的权限。

我建议的方法如下:

  • 在非 root 用户下运行 Apache 作为守护进程进程的代理。
  • 将日志文件夹从 /tmp/ 更改为 /tmp/ 中的某个子文件夹,例如 /tmp/projectname
  • 添加 apache 用户,写入文件夹的权限。

The user, Apache is running under, has no permissions to write into your /tmp/ directory.

My suggested approach for it would be following:

  • Run the Apache as a proxy to the daemon process under a non-root user.
  • Change the log folder from /tmp/ to some sub folder within /tmp, say, /tmp/projectname
  • Add the apache user, permission to write into that folder.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文