January 2019
Beginner to intermediate
776 pages
19h 58m
English
First, we collect our Apache installation paths and some configuration parameters, such as web server user, group, virtual host configuration path, and initialization scripts. These parameters can be defined as constants.
Then, we set up two functions, remote_server() and setup_vhost(), to execute the Apache configuration task using Fabric.
Listing 6.7 gives the code for configuring Apache remotely to host a website as follows:
#!/usr/bin/env python # Python Network Programming Cookbook, Second Edition -- Chapter - 6 # This program is optimized for Python 2.7.12 and Python 3.5.2. # It may run on any other version with/without modifications. from getpass import getpass from fabric.api import env, put, sudo, prompt from fabric.contrib.files ...
Read now
Unlock full access