Skip to content

Commit

Permalink
Merge pull request #32 from n0n0x/add-django-migration-task
Browse files Browse the repository at this point in the history
Add django migrations task
  • Loading branch information
n0n0x authored Feb 15, 2017
2 parents 69e2a9e + 0af7f9a commit 89d6fa9
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 89d6fa9

Please sign in to comment.