Skip to content
Advertisement

How to run server in development mode with flask?

I am learning to use flask and I want to run the server for an application in development mode, for this I do the following:

JavaScript

When I run I get the following in the terminal: enter image description here

Environment:development does not appear to me as I understand it should appear. In fact, before doing this I don’t get Environment:production either, I don’t know what’s going on. As a consequence, every time I want to see the changes that I am making in the code, I have to stop the server and run it again since the changes are not seen when refreshing the page.

Advertisement

Answer

If you’re goal is for the application to restart each time code changes are saved, it shouldn’t require any more than the following:

JavaScript

If you want to see what all your app config variables are set to by default, you can add the following line above app.run

JavaScript

If you wanted to change your environment to production, change the ‘ENV’ variable after you initialize app

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement