Install Flask on webfaction

Add new application in Webfaction


Click the Add an application button, then Create a new application, and in the pop-over form:

Name: my_app (I like to keep the application name the same as the site name, unless I have multiple applications handling one site)
App category: mod_wsgi
App type: mod_wsgi 4.5.2/Python 3.5 (latest versions as of this writing)
Open port: leave unchecked
URL: should be pre-filled with http://example.com/
Save
Once saved, click Save again to finish creating the new website.

Yay! Now visit your domain in your browser and you should see something like this:
1
2
3
4
5
6
Welcome to your mod_wsgi website! It uses:
 
Python 3.5.1 (default, Jan 23 2016, 01:36:36) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
WSGI version: (4, 5, 2)
 

Database if needed

If a database is needed for the site.
Go to Databases > Databases > Add new database
Name: my_app
Database type: PostgreSQL
Encoding: Unicode
Database owner: Create a new postgresql user, and enter your user and password combo here.
Add-ons: leave all unchecked
Save

Setup a virtualenv using python

First, ssh into your web server and change to the site’s webapp directory:

$ ssh user@example.com
$ cd webapps/my_app

Then, let’s make a virtual environment for the new Flask site to run under. I’m calling mine `my_app.

python3.6 -m venv ~/.virtualenvs/my_app

activate your virtualenvsource

source ~/.virtualenvs/my_app/bin/activate

update your pip to make sure it is current

pip install —upgrade pip

Install Flask

pip install Flask

Fixup from virtualenv — this is a hack I don’t know how to get around