Ask coding questions

← Back to all posts
How to prevent flask from opening preview window on each run?
h
nabtron

I am coding a discord bot using python. After making changes i need to run the app again. And this loads the window each time, that i don’t want to open as i can perfectly see the output on output console. How can i prevent browser preview from loading?

Thank you.

Edit: my keep_alive.py file:

Voters
nabtron
Comments
hotnewtop
Coder100

that's not what flask does, that's what replit does.

When you run a repl, replit refreshes the browser window because usually flask apps are made so that they change and users expect to see that.

Is there a problem with the flask app refreshing?

nabtron

@Coder100 i don't want the preview window to open each time, i want to keep the console open on right side only

Coder100

you can click on the x @nabtron

nabtron

@Coder100 i have to click on it with every reload, that is the query, that how to keep it close.

Korbindev

at the botttom when you run if you dont have debug=True try that or if you have it take it off

nabtron

Bottom of which file? @Korbindev

CosmicBear

@nabtron app.run(host='0.0.0.0',port=8080,debug=True)
With this, it will automatically reload the app every time you make an edit.

Korbindev

in def run()@nabtron