【发布时间】:2013-11-05 11:47:00
【问题描述】:
我正在尝试为 Django REST API 框架执行 this tutorial。
使用我的 Apache 设置进行测试时,尝试浏览页面时出现此错误:
TemplateDoesNotExist at /
rest_framework/api.html
但是,如果我通过运行python ./manage.py runserver 使用 Python 测试网络服务器进行测试,它可以正常工作。
我需要在 Apache 中进行一些配置更改来解决此问题吗?
提前致谢。
编辑
我注意到它在错误的位置查找文件:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/usr/local/lib/python2.7/dist-
packages/django/contrib/auth/templates/rest_framework/api.html (File does not exist)
但是我找不到在哪里更改它。
【问题讨论】:
-
你在使用 virtualenv 吗?
-
不,我没有使用 virtualenv。那部分我跳过了,因为我在开发盒上。
-
您好像忘记在您的 INSTALLED_APPS 中添加“rest_framework”了..
-
不,我肯定添加了它。我在发布之前在谷歌上搜索了错误,其中一个解决方案是 @ptrck 所说的,但它不起作用。
标签: python django apache rest django-rest-framework