I get into trouble when I would like to store the image_url for updating the picture of my product. The flask extensions that I used are flask-reuploaded and flask-wtf. I have tried to search a lot but still cannot figure out a solution. Could you help me, please? This is my app.py:
@app.route('/admin/add', methods=['GET', 'POST'])
def add():
form = AddProduct()
if form.validate_on_submit():
image_name = photos.save(form.image.data)
image_url = photos.url(image_name)
return '<h1>{}</h1>'.format(image_url)
return render_template('admin/add-product.html', admin=True, form=form)
I also include <form method="POST" action="{{ url_for('add') }}" enctype="multipart/form-data">
in my template but it doesn't help.
The error message is that werkzeug.routing.BuildError: Could not build url for endpoint '_uploads.uploaded_file' with values ['filename', 'setname']. Did you mean 'product' instead?
Thank you in advance, everyone.