Answer the question
In order to leave comments, you need to log in
Why are images sometimes not showing in Flask?
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)
src="{{ url_for('display_image', filename=user.profile_pic) }}"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question