H
H
hey_umbrella2021-01-01 13:41:34
Flask
hey_umbrella, 2021-01-01 13:41:34

Why are images sometimes not showing in Flask?

61d02ee09a7e7818015596.png
61d02ee51e639394809514.png
I'm making a site on Flask and the user's page is shown on the photo, he can change the photo and banner, in postgreSQL I save only the file name, and then I make this output

@app.route('/img/<filename>')
def display_image(filename):
    return redirect(url_for('static', filename='avatars/' + filename), code=301)

and in html
src="{{ url_for('display_image', filename=user.profile_pic) }}"

I tried a lot of different options for displaying the image, but all the same. Pictures each does not show different, but rarely shows everything.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question