尽管chmod 777,但是符号链接django模板会返回错误

时间:2014-03-05 18:47:22

标签: django symlink

设置

我有django工作,并在我的红帽盒上很好地提供页面。

以下函数将从模板目录中提供“test.html”页面:

def whatever_page(request):
    c = some_dictionary_with_some_data
    return render_to_response('test.html', c, context_instance=RequestContext(request))

这完美无缺。

错误

但是,当我进入模板目录并将test.html更改为/path/to/file/test.html的符号链接时:

ln -s /path/to/file/test.html test.html

在浏览器中重新加载页面,我收到TemplateDoesNotExist错误。

到目前为止我尝试了什么

  • 我尝试chmod 777以防它是权限,但是没有用。
  • 链接文件肯定存在,因为我可以vim test.html并且编辑正常。
  • 我已多次service httpd restart
  • 我尝试在控制台中单步执行它并且工作正常:
[root@14:46:14 static]# ../myproject/manage.py shell
Python 2.7.3 (default, Dec 28 2012, 18:33:11)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.shortcuts import render_to_response
>>> render_to_response("test.html", {})
<django.http.HttpResponse object at 0x1274c10>

为什么它不喜欢符号链接文件?

0 个答案:

没有答案