diff --git a/deployer/fabfile.py b/deployer/fabfile.py index 2b27e7e..63fc73d 100644 --- a/deployer/fabfile.py +++ b/deployer/fabfile.py @@ -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) diff --git a/deployer/tasks/django.py b/deployer/tasks/django.py index c74541d..11c9270 100644 --- a/deployer/tasks/django.py +++ b/deployer/tasks/django.py @@ -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 @@ -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') diff --git a/setup.py b/setup.py index 8248950..6e26168 100644 --- a/setup.py +++ b/setup.py @@ -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",