Forums

One step website deployment with git and fabric

I have been trying to set up something very similar to what is described in this blog post: http://www.jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-right-way/

My fabflie.py is looking something like this:

from fabric.api import lcd, local

def deploy():
    with lcd('/path/to/my/prod/area/'):
    local('git pull /my/path/to/dev/area/')
    local('python manage.py migrate myapp')
    local('python manage.py test myapp')
    local('/my/command/to/restart/webserver') #Is this possible on PythonAnywhere?

Specifically how should I restart the webserver? Is it possible for me to do this from this file or will I need to do it manually via the dashboard interface?

On your web app page, you will see a line like this: "It is configured via a WSGI file stored at: /var/www/web_app_name_wsgi.py". If you touch that file, it will restart the server. Like this:

local('touch /var/www/web_app_name_wsgi.py')

Thanks!