相关疑难解决方法(0)

TemplateDoesNotExist在/

HEJ!这里的许多线程都有相同的标题,但没有一个解决了我的问题.我有一个Django网站可以访问/管理员(但它看起来很难看).但在/上出现以下错误页面(DEBUG = Truein settings.py):

TemplateDoesNotExist at /

index.html

Request Method:     GET  
Request URL:    http://iecl.uni-potsdam.de/  
Django Version:     1.4.5  
Exception Type:     TemplateDoesNotExist  
Exception Value:    

index.html

Exception Location:     /usr/lib/python2.7/dist-packages/django/template/loader.py in find_template, line 138  
Python Executable:  /usr/bin/python  
Python Version:     2.7.3  
Python Path:    

['/home/python/iecl/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg',  
 '/home/python/iecl/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',  
 '/usr/lib/python2.7',  
 '/usr/lib/python2.7/plat-linux2',  
 '/usr/lib/python2.7/lib-tk',  
 '/usr/lib/python2.7/lib-old',  
 '/usr/lib/python2.7/lib-dynload',  
 '/usr/local/lib/python2.7/dist-packages',  
 '/usr/lib/python2.7/dist-packages',  
 '/usr/lib/pymodules/python2.7',  
 '/home/python/iecl/lib/python2.7/site-packages',  
 '/home/django/django']

Server time:    Mon, 7 Apr 2014 11:28:46 +0200  
Template-loader postmortem

Django tried loading these templates, in this order:

    Using loader django.template.loaders.filesystem.Loader:  
        /home/django/django/templates/iecl_dev/index.html (File does not exist)  
    Using …
Run Code Online (Sandbox Code Playgroud)

python django

7
推荐指数
3
解决办法
2万
查看次数

TemplateDoesNotExist - 文件存在,没有权限问题

尝试在 Django 中呈现模板时收到此错误:

模板不存在

...
Template-loader postmortem

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
Run Code Online (Sandbox Code Playgroud)

这是我的 settings.py 条目:

SETTINGS_PATH = os.path.normpath(os.path.dirname(__file__))
TEMPLATE_DIRS = (
    os.path.join(SETTINGS_PATH, 'template'),
)
Run Code Online (Sandbox Code Playgroud)

这是我的观点,被称为:

def handler(request):
    if request.method == 'GET': 
        NewAppFormSet = modelformset_factory(Application)

    return render_to_response(request, "template/apps.html",{"new_app_form":NewAppFormSet})
Run Code Online (Sandbox Code Playgroud)

我已经尝试了所有可能的路径组合、调整权限等。真正的问题似乎出在模板加载器上,因为它们无法识别 TEMPLATE_DIRS 中列出的任何路径。我对这个字符串进行了硬编码,但无济于事。我也python manage.py runserver以 sudo / 作为 root 运行。我不知所措...

django django-templates

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

django ×2

django-templates ×1

python ×1