自从过去两个小时以来,我一直在寻找解决这个问题的方法,并且在这里看到了类似的问题,但解决方案似乎没有工作。我是Flask和Pythonanywhere的初学者,所以我觉得解决方案可能是一件非常愚蠢的事情,我可能会错过。TemplateNotFound error在Pythonanywhere上使用render_template的瓶子
模板被称为givp.html,一切都安排是这样的: 首页>用户>的mysite>模板> givp.html 和 首页>用户>的mysite> apllic.py
我的代码一直在使用的是:
app=Flask(__name__,template_folder='/home/user/mysite/templates')
return render_template('/home/user/mysite/templates/givp.html',lst=d)
事情工作正常我的本地系统,但在这里我一直在收到错误消息。错误日志的最后一行是:
文件 “/home/user/.local/lib/python2.7/site-packages/flask/templating.py”, 线64,在get_source 提高TemplateNotFound(模板)TemplateNotFound:/home/user/mysite/templates/givp.html
非常感谢!它现在有效。知道我错过了一些愚蠢的东西...... –