Run Fabric Programmatically

Call Fabric Programmatically

This will demonstrate that we can call our Fabric deployment script by other scripts. In other words, we can automate deployment!

Luckily it's really easy to do. We'll create a new file and have it call Fabric for us, instead of making us use the command line to call Fabric tasks.

Execute Script

Create new file deploy.py in the same directory as fabfile.py:

import fabfile
from fabric.api import execute

execute(fabfile.deploy)

Resources