TemplateDoesNotExist Django

时间:2015-09-14 06:52:19

标签: django django-templates

我的Django模板位置列为:

python\Lib\site-packages\django\contrib\auth\templates

在我看来,我有:

return render_to_response('hello.html', {'name': name})

当我将hello.html保留在此位置时,它正在运行

python\Lib\site-packages\django\contrib\auth\templates

虽然我将模板位置保持为

TEMPLATE_DIRS = (
    os.path.join(os.path.dirname(__file__), 'templates'),
)

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },

NewProject
    -NewProject
        settings.py
    -signups 
        view.py
             def hello(request):
                 name='vijay'
                 return render_to_response('hello.html',{'name':name})
    templates
        hello.html

0 个答案:

没有答案