Note: The site will be slow sometimes, and may not handle thousands of users all too well, but it’s perfect for the sites I was (and am) making, quick sites, mainly for courses like CS50 web, where that isn’t an issue. This makes it ideal for portfolio and dev sites.

I have found, after completing CS50 in 2018, that deploying Flask apps to Heroku is a pretty useful skill, the way outlined here is purely for development and not for a final production site (however a tutorial for that is on the way)

The first step is getting Heroku’s CLI (Command Line Interface) — I won’t post too much about this process as it varies based on the machine. For macOS, you will need Homebrew before installing the CLI.

Next up is installing Virtual Environments for python this allows us to separate the app / commands from our main system. To do this (ensure you already have pip):

pip install virtualenv

If you have both Pip and Pip3 then run pip3 instead of pip.

Now to enter a new virtual environment, first cd into the correct directory, this should be the folder containing all the files for you app. Then run:

python -m venv env

source env/bin/activate

After this the text (env) should show up on your command line, and a folder named env in your projects directory.

#flask #heroku #python #web-development #free

Deploying a Flask App to Heroku
1.40 GEEK