/index.html上的TemplateDoesNotExist

约瑟夫·宋

我的Django项目有问题。

我是新来使用django制作Web应用程序的。请帮我。

所以,

这是我的目录路径,

-lullabyluna
----app_index
------------admin.py
------------index.html
------------__init__.py
------------migtations
------------models.py
------------tests.py
------------views.py
----index.html(I wonder this files path.)
----lullabyluna
------------__init__.py
------------settings.py
------------url.py
------------wsgi.py
----manage.py
----static

和我的settings.py文件包括:

INSTALLED_APPS = (


    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'app_index',
)

这是我的url.py文件

from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns('app_index.views',
    # Examples:
    url(r'^$', 'home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    url(r'^admin/', include(admin.site.urls)),
)

最后是我的app_index / views.py

from django.template import RequestContext
from django.shortcuts import render_to_response

def home(request):
    return render_to_response('index.html',{},context_instance=RequestContext(request))

因此,我想知道正确的“ index.html”文件的路径在哪里。

用户名

在settings.py中添加它

TEMPLATE_DIRS = (
    PROJECT_PATH 
)

(或)将index.html移至模板文件夹并执行此操作,

TEMPLATE_DIRS = (
    PROJECT_PATH + '/templates/',
)

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

位于/base/index.html的TemplateDoesNotExist

来自分类Dev

TemplateDoesNotExist位于/ blog / index.html

来自分类Dev

位于/ polls / index.html的TemplateDoesNotExist

来自分类Dev

TemplateDoesNotExist位于/ blog / index.html

来自分类Dev

部署到heroku时,位于/base/index.html的TemplateDoesNotExist

来自分类Dev

部署到heroku时,位于/base/index.html的TemplateDoesNotExist

来自分类Dev

index.html不包含浏览器上的链接

来自分类Dev

使用reactjs更改主要index.html上的语言

来自分类Dev

Tomcat不选择index.html上显示的404

来自分类Dev

所有网址上的nginx index.html

来自分类Dev

如何仅显示 index.html 上的文档标题

来自分类Dev

仅在 index.html 页面(Javascript)上运行函数

来自分类Dev

/index.html的.htaccess = /

来自分类Dev

/index.html的.htaccess = /

来自分类Dev

Uncaught TypeError:无法读取index.html:287处动画(index.html:266)上未定义的属性“ rotation”

来自分类Dev

ICollection <T>上的ElementAt(index)

来自分类Dev

Firebase .index在动态键上

来自分类Dev

在表变量上创建INDEX

来自分类Dev

TemplateDoesNotExist,poll / poll.html

来自分类Dev

Joomla index.html文件

来自分类Dev

HTML CSS z-index

来自分类Dev

Azure AngularJS Index.html

来自分类Dev

使url匹配“ /”,“ / index”和“ /index.html”为单个状态

来自分类Dev

index.html更改为index.xhtml

来自分类Dev

在node.js中所有传入的HTTP请求上提供index.html

来自分类Dev

如何使JavaScript在EC2中的index.html文件上运行

来自分类Dev

如何在index.html中使用自定义文本在nginx上创建Deployment?

来自分类Dev

CanJS-如何在index.html上填充视图.ejs

来自分类Dev

grunt-usemin和index.html上的多路径

Related 相关文章

热门标签

归档