pythonflaskterminal

http://127.0.0.1:5000/ Flask server displays the same thing even if I change the source code using


I have written a simple page to be displayed through the link "http://127.0.0.1:5000/". When I first created it is was set to display "Hello World", but now that I have tested to see if it changed the contents of the page if I were to change the code to display "Hello!!!, with three exclamation marks (mind you)".

But it doesn't update it. I have saved the new document and assured it is running on the same port, but it just doesn't update the contents of the webpage.

from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
    return "hello, World!!!, with three exclamation marks (mind you)"


Solution

  • Two things.

    1. You must reload the webpage each time you change the content

    2. You must re-run your flask code if the value inside the return has changed.