Created
March 15, 2013 23:49
-
-
Save flaviozantut/5174116 to your computer and use it in GitHub Desktop.
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
""" Deployment of your django project. | |
""" | |
from fabric.api import * | |
env.hosts = ['yourdomain.com'] | |
env.user = "your-user" | |
def update_django_project(): | |
""" Updates the remote django project. | |
""" | |
with cd('/path/to/your/django/project'): | |
run('git pull') | |
with prefix('source /path/to/your/virtualenv/bin/activate'): | |
run('pip install -r your_pip_requirement_file.txt') | |
run('python manage.py syncdb') | |
run('python manage.py migrate') # if you use south | |
run('python manage.py collectstatic --noinput') | |
def restart_webserver(): | |
""" Restarts remote nginx and uwsgi. | |
""" | |
sudo("service uwsgi restart") | |
sudo("/etc/init.d/nginx restart") | |
def deploy(): | |
""" Deploy Django Project. | |
""" | |
update_django_project() | |
restart_webserver() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment