Created
December 29, 2015 20:33
-
-
Save SpencerCooley/eefd7fff5a27dd15f6b0 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
@task | |
def staging(): | |
env.hosts = ['cooleydigital'] # must have .ssh/config setup | |
env.code_dir = '/webapps/cs_staging/creative_socialite' | |
env.gunicorn_name = 'cs_staging' | |
env.virtualenv = '/webapps/cs_staging/.environments/cs_staging/bin/activate' | |
#change this as you make your workflow more advanced. | |
env.branch_name = 'development' | |
@task | |
def production(): | |
env.hosts = ['cooleydigital'] # must have .ssh/config setup | |
env.code_dir = '/webapps/cs_staging/creative_socialite' | |
env.gunicorn_name = 'cs_production' | |
env.virtualenv = '/webapps/cs_production/.environments/cd_production/bin/activate' | |
#change this as you make your workflow more advanced. | |
env.branch_name = 'master' | |
@notify | |
@task(alias="deployment") | |
def pull(): | |
with cd(env.code_dir): | |
run("git pull origin "+env.branch_name) | |
@notify | |
@task | |
def migrate(): | |
with cd(env.code_dir): | |
run("source "+env.virtualenv+" && python manage.py migrate") | |
@notify | |
@task | |
def restart(): | |
print env.branch_name | |
run('supervisorctl restart '+env.gunicorn_name) | |
@notify | |
@task | |
def pip(): | |
with cd(env.code_dir): | |
run("source "+env.virtualenv+" && pip install -r requirements.txt") | |
@notify | |
@task | |
def static(): | |
with cd(env.code_dir): | |
run("source "+env.virtualenv+" && python manage.py collectstatic") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment