烧瓶不渲染html
这是读取的代码,但烧瓶不渲染html
from flask import Flask,render_template
import psycopg2
import psycopg2.extras
app=Flask(__name__)
app.route('/')
def index():
return render_template('index.html')
if __name__=="__main__":
app.run(debug=True, port=9001)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我没有误解,那只是错别字错误。假设您已经在
模板
文件夹中拥有一个名为index.html
的文件。因此,您的树看起来像这样:此代码应该有效:
现在您可以通过
要了解有关烧瓶视图装饰的更多信息,请。
有关有关
的更多信息,如果__name __ ==“ __ main __”:
,您可以阅读更多此处。If I'm not mistaking, it's just a typo error. Supposed you already have a file called
index.html
in yourtemplates
folder. So your tree look like this:This code should work:
Now you can access to your project at http://127.0.0.1:9001/
To learn more about Flask view decorator, go here.
For more information about what mean
if __name__ == "__main__":
, you can read more here.