Python Django奇怪错误将我的模板名转换为0x000000000461A128
我知道我搞错了,因为谷歌没有返回任何结果。我不太了解计算机,但是Python Django奇怪错误将我的模板名转换为0x000000000461A128,python,django,Python,Django,我知道我搞错了,因为谷歌没有返回任何结果。我不太了解计算机,但是0x00000blah看起来像是某个内存地址。几次刷新后,这个数字就改变了 环境Django 1.8、Python 3.4、chrome、Win7 预期行为 我想进入。/accounts/login/在我的url中也被称为url(r'^login/$,'django.contrib.auth.views.login',name='loginHandle')输入用户名、密码,如果注册了,它会重定向到。/accounts/profile
0x00000blah
看起来像是某个内存地址。几次刷新后,这个数字就改变了
环境Django 1.8、Python 3.4、chrome、Win7
预期行为
我想进入。/accounts/login/
在我的url中也被称为url(r'^login/$,'django.contrib.auth.views.login',name='loginHandle')
输入用户名、密码,如果注册了,它会重定向到。/accounts/profile
,在那里它应该呈现模板profile.html,它会说类似于你好{{username}}!
。相反,我得到了这个错误
TemplateDoesNotExister位于/accounts/profile/
位于0x0000000004D0E400的django.template.backends.django.template对象
视图.py
def profile(request):
profileTemplate = loader.get_template('registration/profile.html')
return render(request, profileTemplate, {
'Kitty': 10,
})
回溯
Using loader django.template.loaders.filesystem.Loader:
D:\users\kitty\python\firstdjangosite\templates\<django.template.backends.django.Template object at 0x0000000004D0E400> (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
D:\Users\kitty\Python\lib\site-packages\django\contrib\admin\templates\<django.template.backends.django.Template object at 0x0000000004D0E400> (File does not exist)
D:\Users\kitty\Python\lib\site-packages\django\contrib\auth\templates\<django.template.backends.django.Template object at 0x0000000004D0E400> (File does not exist)
D:\users\kitty\python\firstdjangosite\polls\templates\<django.template.backends.django.Template object at 0x0000000004D0E400> (File does not exist)
D:\users\kitty\python\firstdjangosite\login\templates\<django.template.backends.django.Template object at 0x0000000004D0E400> (File does not exist)
D:\users\kitty\python\firstdjangosite\accounts\templates\<django.template.backends.django.Template object at 0x0000000004D0E400> (File does not exist)
我以前做过加载程序和渲染,它们工作得很好
TemplateDoesNotExister位于/accounts/profile/
注册/helloworld.html
谢谢您的时间,请帮助我,我很困惑快捷方式采用模板名称
def profile(request):
return render(request, 'registration/profile.html', {
'Kitty': 10,
})
令人惊讶的错误消息是,您传递的是加载的模板而不是模板名称。0x0000000004D0E400处的django.template.backends.django.template对象是profileTemplate的repr()
,快捷方式采用模板名称
def profile(request):
return render(request, 'registration/profile.html', {
'Kitty': 10,
})
令人惊讶的错误消息是,您传递的是加载的模板而不是模板名称。0x0000000004D0E400处的django.template.backends.django.template对象是profileTemplate的repr()
,快捷方式采用模板名称
def profile(request):
return render(request, 'registration/profile.html', {
'Kitty': 10,
})
令人惊讶的错误消息是,您传递的是加载的模板而不是模板名称。0x0000000004D0E400处的django.template.backends.django.template对象是profileTemplate的repr()
,快捷方式采用模板名称
def profile(request):
return render(request, 'registration/profile.html', {
'Kitty': 10,
})
令人惊讶的错误消息是,您传递的是加载的模板而不是模板名称。0x0000000004D0E400处的django.template.backends.django.template对象是profileTemplate
的repr()
,感谢您的快速响应,这很有意义,很有效!干杯(在SO允许的情况下接受)感谢您的快速响应,这是有意义且有效的!干杯(在SO允许的情况下接受)感谢您的快速响应,这是有意义且有效的!干杯(在SO允许的情况下接受)感谢您的快速响应,这是有意义且有效的!干杯(在SO允许的情况下接受)