设置
我有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>
为什么它不喜欢符号链接文件?