Created
May 25, 2015 10:13
-
-
Save joepreludian/085a93afebfb1047913a to your computer and use it in GitHub Desktop.
Simplest Fabfile template for django projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- encoding: utf8 -*- | |
| from fabric.api import env, settings, cd | |
| from fabric.operations import run, sudo | |
| env.hosts = ['trilhus@helena'] | |
| env.project_dir = '/home/trilhus/webapps/projectname' | |
| env.branch = 'master' | |
| def production(): | |
| env.project_dir = '/home/trilhus/webapps/project' | |
| env.branch = 'master' | |
| def run_in_virtualenv(command): | |
| run('%s/env/bin/%s' % (env.project_dir, command)) | |
| def deploy(): | |
| with cd(env.project_dir): | |
| run('git pull origin %s' % env.branch) | |
| run_in_virtualenv('pip install -r requirements.pip') | |
| run_in_virtualenv('python manage.py migrate') | |
| run_in_virtualenv('python manage.py collectstatic --noinput') | |
| run('sudo service nginx restart') | |
| run('sudo service supervisord restart') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment