Django Can';找不到我的模板
我发现了很多这样的问题,但没有人解决这个问题 当我访问url时Django Can';找不到我的模板,django,django-templates,django-views,web-development-server,Django,Django Templates,Django Views,Web Development Server,我发现了很多这样的问题,但没有人解决这个问题 当我访问url时 http://localhost:8000/catalog/book/88a26558-d636-44c8-8831-242d98fa6d80/renew/ 由以下URL.py路径处理的: path('book/<uuid:pk>/renew/', views.renew_book_librarian, name='renew-book-librarian'), 但我得到了模板错误: TemplateDoesNotE
http://localhost:8000/catalog/book/88a26558-d636-44c8-8831-242d98fa6d80/renew/
由以下URL.py路径处理的:
path('book/<uuid:pk>/renew/', views.renew_book_librarian, name='renew-book-librarian'),
但我得到了模板错误:
TemplateDoesNotExist at /catalog/book/88a26558-d636-44c8-8831-242d98fa6d80/renew/
catalog/book_renew_librarian.html
Request Method: GET
Request URL: http://localhost:8000/catalog/book/88a26558-d636-44c8-8831-242d98fa6d80/renew/
Django Version: 2.0.3
Exception Type: TemplateDoesNotExist
Exception Value:
catalog/book_renew_librarian.html
Exception Location: C:\Users\Araujo\AppData\Local\Programs\Python\Python36\lib\site-packages\django\template\loader.py in get_template, line 19
Python Executable: C:\Users\Araujo\AppData\Local\Programs\Python\Python36\python.exe
Python Version: 3.6.4
Python Path:
['C:\\Users\\Araujo\\Desktop\\first_django\\locallibrary',
'C:\\Users\\Araujo\\AppData\\Local\\Programs\\Python\\Python36\\python36.zip',
'C:\\Users\\Araujo\\AppData\\Local\\Programs\\Python\\Python36\\DLLs',
'C:\\Users\\Araujo\\AppData\\Local\\Programs\\Python\\Python36\\lib',
'C:\\Users\\Araujo\\AppData\\Local\\Programs\\Python\\Python36',
'C:\\Users\\Araujo\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages']
Server time: Wed, 14 Mar 2018 19:19:10 +0000
但是我有一个模板在
\catalog\templates\book_renew_librarian.html
如何解决 指定路径的目录结构应为:
ProjectFolder
-projectfolder
-catalog
-templates
-catalog
book_renew_librarian.html
-manage.py
指定路径的目录结构应为:
ProjectFolder
-projectfolder
-catalog
-templates
-catalog
book_renew_librarian.html
-manage.py
我试过了,但没用。。。它是否与de模板中的内容相关?catalog/templates/catalog/book\u renew\u librariar.html应该可以正常工作。非常感谢!给django中的东西提供路径的标准(最佳)方式是什么?这取决于您的意愿,我更喜欢为该项目文件夹之外的模板指定一个目录。看看这个:我已经试过了,但是不起作用。。。它是否与de模板中的内容相关?catalog/templates/catalog/book\u renew\u librariar.html应该可以正常工作。非常感谢!给django中的东西提供路径的标准(最佳)方式是什么?这取决于您的意愿,我更喜欢为该项目文件夹之外的模板指定一个目录。看看这个: