1

I'm creating webapp by using Flask on backend and HTML, CSS, Bootstrap 4 on frontend and havenot using a single line of code of javascript. My flask app code is:

from flask import Flask, render_template
app = Flask(__name__)

@app.route('/')
def index():
    return render_template('index.html')

if __name__ == '__main__':
    app.run(debug=True)

But, the issue is when I add an image in HTML code it works completely fine. But if I replace the file in directory with same name but when I preview it in browser while coding it shows the old picture. I'm using Bootstrp 4.6

The image code inside a simple div is:

<img class="img-fluid" src="/static/about.svg" alt="Students">
1
  • 1
    Clearing your cache might help. Commented Apr 11, 2021 at 7:48

2 Answers 2

1

That because of your local browser cache (see in the network panel of our browser dev tools : image requests don't have a 200 http status code). You should want to disable it during development.

But you must handle it in production too, with plugins like Flask-caching or with cache control mecanisms.

Sign up to request clarification or add additional context in comments.

Comments

0

In a youtube tutorial, I get to know that by refreshing page while pressing "Ctrl-key" clears the cache. And it worked for me.

1 Comment

thats the manual way to clear local cache :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.