Hosting a Flask app

The Flask quickstart guide is great. However when it was time to deploy it on my DigitalOcean, I found it impossible to access.

The doc says you should run to open it to external machines:

flask run --host=0.0.0.0

Yet I couldn't reach it remotely. Turns out my server was blocking port 5000. To open it I had to run:

ufw allow 5000/tcp

It turns out this is highly discouraged, and I should host it in a safer way. https://flask.palletsprojects.com/en/master/deploying lists the alternatives. I'll read up on them later.