我在本地机器上用django创建了一个应用程序,它可以完美地处理所有模板和html文件,但当我尝试在heroku上托管它时,它会加载主页,但当我尝试创建一个新博客时,它会说模板不存在。
这是我一直得到的错误:
Request Method: GET
Request URL: https://ifecrudapp.herokuapp.com/post/new/
Django Version: 3.2
Exception Type: TemplateDoesNotExist
Exception Value:
blog/post_form.html
Exception Location: /app/.heroku/python/lib/python3.9/site-packages/django/template/loader.py, line 47, in select_template
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.9.4
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python39.zip',
'/app/.heroku/python/lib/python3.9',
'/app/.heroku/python/lib/python3.9/lib-dynload',
'/app/.heroku/python/lib/python3.9/site-packages']
Template-loader postmortem
Django tried loading these templates, in this order:
Using engine django:
django.template.loaders.filesystem.Loader: /app/templates/blog/post_form.html (Source does not exist)
django.template.loaders.filesystem.Loader: /app/blog/templates/blog/blog/post_form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /app/blog/templates/blog/post_form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /app/users/templates/blog/post_form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /app/.heroku/python/lib/python3.9/site-packages/crispy_forms/templates/blog/post_form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/templates/blog/post_form.html (Source does not exist)
django.template.loaders.app_directories.Loader: /app/.heroku/python/lib/python3.9/site-packages/django/contrib/auth/templates/blog/post_form.html (Source does not exist)
暂无答案!
目前还没有任何答案,快来回答吧!