如何上传和显示图像
**> **我尝试上传和显示图像在我的模板html上传图片我有成功,但当我想显示图像,服务器说
“得到静态404”任何人都可以帮助我?
views.py @ app.route(“/ upload /”,methods = ['GET','POST'])@login_required def upload(username):form = PhotoForm()user =
User.query.filter_by(用户名=用户名)。首先()
如果request.method =='POST'和form.validate_on_submit():
f = form.photo.data
filename = secure_filename(f.filename)f.save(os.path.join(app.config ['UPLOAD_FOLDER'],filename))
返回重定向(url_for('user',username = user.username,filename = filename,f = f))return render_template(“change_profile_picture.html”,form = form)