Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

need to render python in html using flask

this is the 1st time I am rendering HTML using python and flask so my concepts are very new..

I tried the A Simple Example in Project and my issue is if I change return "Hello, World!" in the hello() python function to say return "ABC XYZ" and do a refresh of the browser url(http://127.0.0.1:5000/), the new value (ABC XYZ) doesnt get rendered immediately; so how do I make it to render upon a browser refresh?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The problem here is that the Flask application does not auto-reload even if you make any changes in code files.

But if you want Flask to auto-reload whenever you save(or change) any file then you have to set debug to True

If you are using app.run() then do this

app.run(debug=True)

or if you running it using a command line like flask run. Then add --debug in the command.

example

flask –app Project run –debug

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading