这个错误是什么意思?
File "C:\Users\Admin\Projects\trydjango\musicyltd\restaurants\views.py", line 25, in contact
return render(request, "contact.html", context)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\shortcuts.py", line 36, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\loader.py", line 62, in render_to_string
return template.render(context, request)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\backends\django.py", line 63, in render
reraise(exc, self.backend)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\backends\django.py", line 84, in reraise
raise new from exc
django.template.exceptions.TemplateDoesNotExist: base.html
[25/Apr/2018 13:54:27] "GET /contact/ HTTP/1.1" 500 120949
答案 0 :(得分:2)
您的contact.html
加载base.html
但加载程序无法找到它。这是由指向错误路径的{% extends %}
或不存在的模板引起的。