2015-06-22 69 views
0

我得到错误“未找到模板”,虽然我已经设置了正确的模板层次(或因此我认为)Django的模板在主项目目录错误未找到

. 
├── manage.py 
├── twinja 
│   ├── admin.py 
│   ├── admin.pyc 
│   ├── __init__.py 
│   ├── __init__.pyc 
│   ├── migrations 
│   │   ├── __init__.py 
│   │   └── __init__.pyc 
│   ├── models.py 
│   ├── models.pyc 
│   ├── tests.py 
│   └── views.py 
└── twinjasite 
    ├── __init__.py 
    ├── __init__.pyc 
    ├── settings.py 
    ├── settings.py~ 
    ├── settings.pyc 
    ├── static 
    │   └── twinja 
    │    ├── fonts 
    │    │   └── bootstrap 
    │    │    ├── glyphicons-halflings-regular.eot 
    │    │    ├── glyphicons-halflings-regular.svg 
    │    │    ├── glyphicons-halflings-regular.ttf 
    │    │    ├── glyphicons-halflings-regular.woff 
    │    │    └── glyphicons-halflings-regular.woff2 
    │    ├── images 
    │    ├── javascripts 
    │    │   ├── bootstrap 
    │    │   │   ├── affix.js 
    │    │   │   ├── alert.js 
    │    │   │   ├── button.js 
    │    │   │   ├── carousel.js 
    │    │   │   ├── collapse.js 
    │    │   │   ├── dropdown.js 
    │    │   │   ├── modal.js 
    │    │   │   ├── popover.js 
    │    │   │   ├── scrollspy.js 
    │    │   │   ├── tab.js 
    │    │   │   ├── tooltip.js 
    │    │   │   └── transition.js 
    │    │   ├── bootstrap.js 
    │    │   ├── bootstrap.min.js 
    │    │   └── bootstrap-sprockets.js 
    │    └── stylesheets 
    │     ├── framework.css 
    │     └── styles.css 
    ├── templates 
    │   └── twinja 
    │    ├── base.html 
    │    └── menu.html 
    ├── urls.py 
    ├── urls.py~ 
    ├── urls.pyc 
    ├── views.py 
    ├── views.py~ 
    ├── views.pyc 
    ├── wsgi.py 
    └── wsgi.pyc 

起初我设置up templates/base但这没有奏效。所以我做到了,因为你在这里看到:templates/twinja/base

理想情况下,我设置了独立于应用程序的主要模板文件,我认为它应该放在主文件夹中(其中settings.py是),但也许我错了。

是的,我在'已安装的应用程序中设置'twinja'。

这里出现什么问题?

TemplateDoesNotExist at/
twinja/base.html 

回答

1

如果你的模板是独立的应用程序,它不应该在你的应用程序文件夹 - 命名空间会相应。

如何加载模板?您是否在settings.py中设置了templates/static文件夹?

更新

对于新鲜的项目,您需要配置您的settings.py文件。请阅读here,问问你是否还有问题。

更新

在熟悉静态文件以及如何管理这些文件之后,请花一些时间here

+0

不,我正在使用默认的settings.py,但添加的数据库除外。 – 1Up