# Publ: Passenger

Last updated:

Deployment using Phusion Passenger (also known as Passenger WSGI) is fairly straightforward, once you have a python3 environment working. However, on some web hosts, setting up python3 isn’t quite obvious.

### Building Python 3

First you need a Python 3 environment. If your hosting provider doesn’t provide one (you can check by running python3 from the command line), there are a few ways to install it yourself.

The easiest way is to use pyenv:

After a while you should be able to verify that you have a working Python 3 installation with e.g.

If all worked well, you can now install pipenv:

and, optionally, add this line to your ~/.bash_profile to get better shell tab completion:

### Set up the virtual environment

Now it’s time to set up your virtual environment for Publ. Again, ssh to your webhost and do the following:

This sets up the virtual environment and installs Publ and its dependencies. Now you need to write a passenger_wsgi.py script that tells Passenger how to run it. A fuller example is in the files for this site but a minimal version is below:

### Configure the website

Once you get your files on your server, it’s generally a matter of telling Passenger where to find the files. Generally, this involves going to your web host’s configuration panel and configuring your website to use Passenger. Different hosts may have different requirements. Known configurations are below:

#### Dreamhost

Configure your web domain as follows:

• Web directory: /home/(username)/(site file directory)/public
• HTTPS (via LetsEncrypt): Yes
• Passenger (Ruby/NodeJS/Python apps only): Yes

You will also need to have a public directory, ideally with a symbolic link to your static directory inside of it; you can set this up by logging in and doing something like:

You will also probably want to create a .htaccess file under public/ with the following contents:

### Care and feeding

Upgrading Publ should just be a matter of sshing to your host, cding into the site directory, and running:

After doing this, or after changing any site templates, you’ll want to restart your website. On Dreamhost you do this with: