I'm writing a small locally-running flask powered web app for some coworkers. They aren't super technologically savvy so I'd like them to be able to simply double click a link to run a shell script, which will start the flask server and then pop open the localhost page on their macs.
I've created a simple file start
:
python server.py
open http://localhost:5000
But it pops open two webpages - first the localhost (but with an "unable to connect" message) and then the localhost again with it working. So odd!
I tried using the webbrowser
module in python, but this has the same effect:
if __name__ == '__main__':
app.debug = True
webbrowser.open("http://localhost:5000/")
app.run()
and putting it afterwards:
if __name__ == '__main__':
app.debug = True
app.run()
webbrowser.open("http://localhost:5000/")
only opens the page after the server is shutdown.
Any ideas? I guess they could just close the non-working page, but it isn't very smooth functionality.