Answer the question
In order to leave comments, you need to log in
FLASK How to insert an image from anywhere?
Good afternoon!
I need to upload an image from any directory on my computer.
For example, the following method:
.format(url_for('static', filename='filename.jpg'))
.format('path/to/filename.jpg')
Answer the question
In order to leave comments, you need to log in
You can solve this problem in different ways, for example:
Make a symbolic link to the folder.
Or you can do it through CUSTOM_STATIC_PATH, which you specify in the config and write
return send_from_directory(app.config['CUSTOM_STATIC_PATH'], filename=filename, mimetype='image/jpeg')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question