我将index.html放在/静电/文件夹中.当我try 时,我的Django应用程序运行正常:
http://127.0.0.1:8000/index.html
但是我想通过url访问index.html:
http://127.0.0.1:8000/
我写了一个视图,它起作用了:
class IndexView(TemplateView):
template_name = 'index.html'
我还添加了urls.py(这样我就可以提供http://127.0.0.1:8000/css/style.css
%的静电服务):
url(r'^(?P<path>.*)$', 'django.contrib.staticfiles.views.serve', {
'document_root': settings.STATIC_ROOT, 'show_indexes':True
}),
但我认为有一种方法可以在没有TemplateView的情况下执行我想要的操作.
有什么建议吗?谢谢.我的Django 版本是:Django 1.5
EDIT:
The reason i placed index.html into static: i want to make Phonegap compatible django app, so after proper coding, all i have to do is --> make .zip from static folder and upload it to Phonegap as mobile app. Easy and clean.