我是PyCharm岁的新手,我正试图用它来开发Django.我的应用程序 struct 如下:
bs3app/
├── __init__.py
├── templates
│ └── home.html
├── urls.py
└── views.py
bs3app/views.py
年后,我得到一个警告:
找不到模板文件‘home.html’
源代码:
from django.shortcuts import render_to_response
def home(request):
return render_to_response('home.html')
模板文件在bs3app/templates/home.html
中.当我运行站点时,home
视图工作正常.在项目的Django Support页上,Enable Django Support是打开的,Django project root、Settings、Manage script值都是正确的.
那为什么我会收到警告呢?按照this PyCharm doc page,我可以显式地标记模板目录,然后警告就会消失,但是为什么我要have to呢?既然项目有settings.py
个文件,为什么PyCharm不能自动找出它们呢?
如果您需要查看其他文件,则该项目位于GitHub.