P
P
PRoGRamm_InG2021-10-31 11:35:45
Python
PRoGRamm_InG, 2021-10-31 11:35:45

Flask after running the code, the site does not change. Why?

I wrote

the code
from flask import Flask, render_template

app = Flask(__name__)

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

@app.route('/link1')
def link1():
    return "ссылка1"

@app.route('/link2')
def link2():
    return "ссылка2"

@app.route('/link3')
def link3():
    return "ссылка3"

if __name__ == '__main__':
    app.run(debug=True)
after which I launched it and went to the site, but it was the same as before running this code. How to fix?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-10-31
@PRoGRamm_InG

this is a cache invalidation on the client side, and that’s a big ideological trouble (not a bug but a feature)
in the browser, press ctrl + f5 to force refresh the data in the cache
for the future, as one of the solutions, all links to static files should be made with their version number (or to example hash)
https://example.org/main.css?ver=1
or
https://example.org/main.7f1acc2b.css
where 7f1acc2b is some hash of the file contents (the main thing is to change when it changes)
respectively files must be renamed after publishing, including links to them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question