Heroku is a powerful app service platform that gives you highly responsive, global reach for just a few dollars a month. Flask is a web micro-platform that allows you to build responsive custom apps quickly. Guilding apps in Flask and deploying them to Heroku is a great solution, provided you know the caveats.
Getting Started with Flask on Heroku
Heroku offers a powerful tech stack for serving performant apps worldwide via the web. However, deploying Flask apps to Heroku is not without its pitfalls. The Heroku tech stack is steadily changing, and this introduces further complexity when building your app. Building your flask app from scratch and then deploying it to Heroku can be tricky, especially if you are new to the Heroku platform or the Flask micro-framework.
Environment
Begin by setting up the Python development environment. Four our purposes, we will be developing on a Windows 10 computer using Visual Studio Code (VS Code).
python.exe -m venv .venv
Visual Studio Code itself is available not only for Windows, but also Linux and MacOS. At its core, Visual Studio Code is a text editor. In typical Microsoft fashion, VS Code has numerous extensions, plugins and integrations that give it the feel of a lightweight IDE (integrated development environment), but it is in fact a text editor, not an IDE like Visual Studio.
As well, when we use the terminal that is built into VS Code, many of the Linux/Unix operating system commands to which we are accustomed will work.
Git and GitHub
Push the code to the GitHub repository. We do this first because this is faster.
git push spycebot master
Push the code to the Heroku server. We do this second as it is more involved. You will see the progress of the server-side build in the terminal.
git push heroku master
Observe the heavy lifting.
Domain Name Services
Records to create are ANAME and CNAME in addition to the wildcard.
Secure Site Certificates
Secure site certificate generation in the web UI requires that the app be registered on the command line.
Conclusion
Flask leverages the Heroku technical stack in an intuitive and straightforward way.