modify our
settings.py
. Then
pip3 install -r requirements.txt
, completes happily,
noting that the existing virtualenv already has all the packages we need.
collectstat
ic
also notices that the static files are all already there, and finally the
migrate
completes
without a hitch.
Fabric Configuration
If you are using an SSH key to log in, are storing it in the default location, and are using
the same username on the server as locally, then Fabric should “just work”. If you aren’t
there are several tweaks you may need to apply in order to get the
fab
command to do
your bidding. They revolve around the username, the location of the SSH key to use, or
the password.
You can pass these in to Fabric at the command line. Check out:
$
fab --help
Or see the
Fabric documentationfor more info.
Deploying to Live
So, let’s try using it for our live site!
$
fab deploy
:host=elspeth@superlists.ottg.eu$ fab deploy --host=superlists.ottg.eu
[superlists.ottg.eu] Executing task 'deploy'
[superlists.ottg.eu] run: mkdir -p /home/elspeth/sites/superlists.ottg.eu
[superlists.ottg.eu] run: mkdir -p /home/elspeth/sites/superlists.ottg.eu/databa
[superlists.ottg.eu] run: mkdir -p /home/elspeth/sites/superlists.ottg.eu/static
[superlists.ottg.eu] run: mkdir -p /home/elspeth/sites/superlists.ottg.eu/virtua
[superlists.ottg.eu] run: mkdir -p /home/elspeth/sites/superlists.ottg.eu/source
[superlists.ottg.eu] run: git clone
https://github.com/hjwp/book-example.git/ho
[superlists.ottg.eu] out: Cloning into '/home/elspeth/sites/superlists.ottg.eu/s
[superlists.ottg.eu] out: remote: Counting objects: 3128, done.
[superlists.ottg.eu] out: Receiving objects: 0% (1/3128)
[...]
[superlists.ottg.eu] out: Receiving objects: 100% (3128/3128), 2.60 MiB | 829 Ki
[superlists.ottg.eu] out: Resolving deltas: 100% (1545/1545), done.
[superlists.ottg.eu] out:
[localhost] local: git log -n 1 --format=%H
[superlists.ottg.eu] run: cd /home/elspeth/sites/superlists.ottg.eu/source && gi
[superlists.ottg.eu] out: HEAD is now at 6c8615b use a secret key file
[superlists.ottg.eu] out:
[superlists.ottg.eu] run: sed -i.bak -r -e 's/DEBUG = True/DEBUG = False/g' "$(e
[superlists.ottg.eu] run: echo 'ALLOWED_HOSTS = ["superlists.ottg.eu"]' >> "$(ec
[superlists.ottg.eu] run: echo 'SECRET_KEY = '\\''mqu(ffwid5vleol%ke^jil*x1mkj-4
Trying It Out
|
163