Get Flask up and running on a DreamHost server with Passenger

The following tutorial will tell you how to get the Python microframework Flask, up and running on a DreamHost server. This tutorial applies to both shared and VPS and we are using Passenger.

First step is to visit the DreamHost panel and set up a new domain or current one to use Passenger. Visit and click the edit link underneath the Web Hosting column to the right of the domain. Within the web options heading there is a “Passenger (Ruby/NodeJS/Python apps only):” checkbox that must be checked to enable Passenger support for the domain.

Next, connect to the server via SSH and install virtualenv according to the instructions DreamHost has provided at

Once that is complete we can begin to install flask inside our new Python environment.

Make sure you are within the Python environment just created. You should something similar to the following on your command line:

If not make sure to activate it as noted in the virtualenv tutorial linked above.

Now that we have flask installed we can create a hello world flask script.

def hello_world():
return “Hello, World!”

I saved and named the file Python apps on Passenger run via the WSGI interface. In our main app directory we are going to add a a file need passenger.wsgi and import our application. The following is a very basic implementation.

In the python world you import a file without the py extension. In this case hello refers to the file.

Now we need to tell Passenger where to find our custom Python install. We need Passenger to load up our custom Python and accompanying modules. This is done in via an .htaccess file.

One more step. We create a tmp directory and add a restart.txt file so we can reload Passenger so it servers our updated files.

Visit the site in a browser and you should see a plain text hello world page.

Flask DreamHost
Flask DreamHost
  • Hey! Can you help me whith this?
    I think you have some typo on your text, so I didn’t understand it right. 🙁

    I tried exactly as you said, but nothing happened.