TemplateSyntaxError at / Caught IOError while rend

2019-07-30 15:41发布

问题:

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?

回答1:

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.


回答2:

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?