我做了一个简单的网站,用户上传一个图像,然后显示在页面上。在get_root中:
@app.route('/', methods=['POST', 'GET'])
def get_root():
if request.method == 'POST':
return render_template("webpage2.html", image = upload_file())
return render_template("webpage2.html")
在upload_文件中:
^{pr2}$在上载的_file()中:
@app.route('/image/', methods = ['POST', 'GET'])
def uploaded_file(filename):
return send_from_directory(app.config['UPLOAD_FOLDER'], filename)
当我测试它时,页面加载,但没有图像,并且我在控制台上得到以下错误:
TypeError: uploaded_file() takes exactly 1 argument (0 given)
我尝试了很多变体,但这对我来说主要的问题是:将正确的参数传递到上载的_文件。在
目前没有回答
相关问题 更多 >
编程相关推荐