Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask not reacting to code changes

Tags:

python

flask

I am new to Flask and am implementing a tiny application. I successfully got it to display "Hello World" when visiting a certain web page, but I cannot change it to say "Hello World Again," even if I change the code. Why is it still running the old code and how can I get it to run the new code? Thanks.

like image 867
abw333 Avatar asked Apr 07 '26 13:04

abw333


1 Answers

You need to run the app in debug mode:

app.debug = True
app.run()

or

app.run(debug=True)

But remember, only do that in your development environment:

Even though the interactive debugger does not work in forking environments (which makes it nearly impossible to use on production servers), it still allows the execution of arbitrary code. This makes it a major security risk and therefore it must never be used on production machines.

You could also use use_reloader=True without enabling debug mode, but that's not a good idea since you really want the debugger during development.

like image 92
ThiefMaster Avatar answered Apr 10 '26 02:04

ThiefMaster