我已在Heroku上成功部署了Django应用。但是它根本没有运行。这里显示的问题是TemplateDoesNotExist错误,该错误指示它找不到我在其他每个模板中扩展的 base.html 文件。但是我已经在本地环境中运行了所有模板。
这是错误的日志-
lines = [['ladybug7501',
'RT SamaritansPurse: You can help the many across #PuertoRico who remain in desperate need after #HurricaneMaria. See how here: …',
'Negative',
-1],
['DyEliana',
'RT daddy_yankee: La madre naturaleza está azotando con potencia a sus hijos. Mi corazón y mis oraciones con mi tierra #PuertoRico y mis he…',
'Neutral',
0],
['waffloesH',
'RT SteveCase: PLEASE HELP: ChefJoseAndres is working tirelessly to feed #PuertoRico, but urgently needs our help: ',
'Neutral',
0],
['SteveLevinePR',
'RT StarrMSS: .elvisduran gave 30K to @Bethenny to charter plane to bring supplies to #PuertoRico HurricaneMaria. He also gave 100K to ',
'Neutral',
0],
['bronxdems',
'RT theCEI: THANK YOU to rubendiazjr and the NY Hispanic Clergy for organizing an amazing event last week in support of PuertoRico! ??❤️…',
'Positive',
3]]
模板加载器事后显示以下问题-
user_lines = []
for line in lines:
freqs = {}
user_lines.append(line[2])
for i in user_lines:
if i not in freqs:
freqs[i] = 1
else:
freqs[i] += 1
freqs
settings.py 文件如下所示-
TemplateDoesNotExist at /
base.html
Request Method: GET
Request URL: https://barikoi.herokuapp.com/
Django Version: 2.2
Exception Type: TemplateDoesNotExist
Exception Value:
base.html
Exception Location: /app/.heroku/python/lib/python3.6/site-packages/django/template/backends/django.py in reraise, line 84
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.6.11
Python Path:
['/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']
Server time: Sun, 12 Jul 2020 13:26:22 +0000
我尝试了此answer的解决方案,但对我而言不起作用。
我检查了本地环境中的所有内容,一切似乎都正常。
我的开发环境是Windows。