python - 将 Django 部署到 Heroku (TemplateDoesNotExist)
问题描述
我只是将项目部署到 Heroku,但是找不到模板。有人可以帮我吗
设置.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [ os.path.join(BASE_DIR,'Users/jay/Downloads/PJ/ecommerce/templates') ],
'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',
],
},
},
]
错误信息:
异常类型:TemplateDoesNotExist 异常值:
list.html 异常位置:/app/.heroku/python/lib/python3.6/site-packages/django/template/loader.py in get_template,第 19 行 Python 可执行文件:/app/。 heroku/python/bin/python Python 版本:3.6.8 Python 路径:
['/app/.heroku/python/bin', '/app', '/app/.heroku/python/lib/python36.zip', '/app/.heroku/python/lib/python3.6', '/app/.heroku/python/lib/python3.6/lib-dynload', '/app/.heroku/python/lib/python3.6 /site-packages'] 服务器时间:Thu, 22 Aug 2019 09:51:24 +0000 Template-loader postmortem
Django 尝试按以下顺序加载这些模板:
使用引擎 django: django.template.loaders.filesystem.Loader: /app/Users/jay/Downloads/PJ/ecommerce/templates/list.html (来源不存在) django.template.loaders.app_directories.Loader: /app /.heroku/python/lib/python3.6/site-packages/django/contrib/admin/templates/list.html(源不存在)django.template.loaders.app_directories.Loader: /app/.heroku/python /lib/python3.6/site-packages/django/contrib/auth/templates/list.html(源不存在)django.template.loaders.app_directories.Loader:/app/.heroku/python/lib/python3。 6/site-packages/crispy_forms/templates/list.html(源不存在)django.template.loaders.app_directories.Loader: /app/accounts/templates/list.html(源不存在)django.template.loaders .app_directories.Loader:/app/carts/templates/list.html(源不存在)django.template.loaders。app_directories.Loader: /app/orders/templates/list.html (来源不存在) django.template.loaders.app_directories.Loader: /app/.heroku/python/lib/python3.6/site-packages/bootstrap4/模板/list.html(源不存在)
解决方案
推荐阅读
- ios - 用于 arm64e 的 Delphi Tokyo IOS 应用程序开发
- python - 密集与时间分布式(密集)
- r - For循环:要替换的项目数不是替换长度的倍数
- java - 如何在 Java Spring 中将属性名称放入 JSON 中
- excel - 查找重复项并将它们放在主文件夹中
- php - 编辑数据时如何获取选定值 [codeigniter]
- javascript - Sqlite3 导致错误:模块没有自注册
- java - ID 可能未使用 @GeneratedValue 初始化
- java - Spring安全抛出未经授权而不是重定向到登录
- angular - 使用服务的具有多个表单的单个提交按钮