Ujjwal Pandey
Ujjwal Pandey

Reputation: 1

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!"

Upvotes: 0

Views: 3220

Answers (2)

CY_
CY_

Reputation: 7618

  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)

Upvotes: 1

M_x
M_x

Reputation: 867

set this in terminal

export FLASK_ENV=development

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

Upvotes: 2

Related Questions