Consider this simple hello world flask example.
from flask import Flask
app = Flask(__name__)
@app.route("/inst")
def index():
print('Hello World!')
return "Hello World!"
if __name__ == '__main__':
app.run(debug=True, use_reloader=False)
When I hit browser with the route url, the print statement gets executed twice. The output of console is as follows:
* Serving Flask app "main" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [04/Jan/2020 18:22:46] "GET /inst HTTP/1.1" 200 -
Hello World!
Hello World!
127.0.0.1 - - [04/Jan/2020 18:22:46] "GET /inst HTTP/1.1" 200 -
Why does the GET /inst called twice? Is this way it's supposed to be?