Skip to content

Commit

Permalink
Add django migrations task
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiago Del Castillo committed Feb 15, 2017
1 parent d32a7ad commit 0af7f9a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deployer/fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def setup_environment():
setup_virtualenv(env.python_version, env.app_name, env.app_dir, env.repo_url)

@task
def deploy(branch='master'):
def deploy(branch='master', migrate=False):
with shell_env(HOME='/home/' + env.user, PATH="/home/" + env.user + "/.pyenv/bin:$PATH"):
with cd(env.app_dir):
deploy_code(env.repo_url, env.app_dir, env.user, branch=branch)
Expand Down
8 changes: 7 additions & 1 deletion deployer/tasks/django.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from fabric.api import run
from fabric.api import run, runs_once
from fabric.decorators import with_settings

from fabtools import require
Expand All @@ -8,3 +8,9 @@
def collectstatic(app_name='', python_version=''):
with virtualenv('/home/deploy/.pyenv/versions/{0}-{1}'.format(app_name, python_version)):
run('python manage.py collectstatic -v0 --noinput')

@runs_once
@with_settings(warn_only=True)
def migrate(app_name='', python_version=''):
with virtualenv('/home/deploy/.pyenv/versions/{0}-{1}'.format(app_name, python_version)):
run('python manage.py migrate')
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

setup(
name="deployer",
version="1.2.3",
version="1.2.4",
description="Streema deployer library",
long_description=readme,
author="Streema Devs",
Expand Down

0 comments on commit 0af7f9a

Please sign in to comment.