1.显示图片
想要Flask在网页中显示图片,需要使用template 模板,例如
index.py
from flask import Flask, render_template, url_for
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello_world(<
本文介绍了如何在Flask应用中显示图片,强调图片需放置在static目录下。同时,针对Flask默认12小时的静态文件缓存时间问题,提出了设置缓存时间的方法,以确保图片更新后能够及时在网页上显示。
想要Flask在网页中显示图片,需要使用template 模板,例如
index.py
from flask import Flask, render_template, url_for
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello_world(<
3376

被折叠的 条评论
为什么被折叠?