简体   繁体   中英

Flask not updating python code dynamically

I am running a web application that return hello world to a web browser using python. The code is as follows:

  1. Code:

     from flask import Flask app = Flask(__name__) @app.route("/") def index(): return "Hello World!"
  2. after this i am using the command flask run to run the application.py file

  3. Which is working fine on browser. but now if i reset the code again on application.py file to return "Hello world! hello again" and reload the website port the results are not affected in the browser It still returns "Hello World!"

set this in terminal

export FLASK_ENV=development

or if this not work then try to open URL in other browser

  1. check the log in terminal to see whether it get re-loaded after your update.
  2. if not, activate the debug mode in flask: https://flask.palletsprojects.com/en/1.1.x/quickstart/#debug-mode
export FLASK_DEBUG=1  //Linux or Mac:
set FLASK_DEBUG=1    //windows
  1. also try in Incognito Windows of Browser (which is cache-free)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM