Exemplo n.º 1
0
def deploy():
    """Deploy the project: fab [environment] deploy"""
    push()
    with cd(env.path):
        run('git pull {push_remote} {push_branch}'.format(**env))
        with _venv(env.virtualenv_path):
            run('pip install -Ur {requirements}'.format(**env))
        migrate()
        with _venv(env.virtualenv_path):
            run('./manage.py collectstatic --noinput {settings}'.format(**env))
            # run('./manage.py compilemessages %(settings)s'.format(**env))
    restart()
Exemplo n.º 2
0
def deploy():
    """Deploy the project: fab [environment] deploy"""
    push()
    with cd(env.path):
        run('git pull {push_remote} {push_branch}'.format(**env))
        with _venv(env.virtualenv_path):
            run('pip install -Ur {requirements}'.format(**env))
        migrate()
        with _venv(env.virtualenv_path):
            run('./manage.py collectstatic --noinput {settings}'.format(**env))
            # run('./manage.py compilemessages %(settings)s'.format(**env))
    restart()
Exemplo n.º 3
0
def run_command(command):
    """
    Run a management command: fab [environment] run_command my_command
    Example: fab production run_command:'./manage.py check'
    """
    with cd(env.path):
        with _venv(env.virtualenv_path):
            run('{command} {settings}'.format(command=command, settings=env.settings))
Exemplo n.º 4
0
def show_crontab():
    """Show the current crontab entries: fab [environment] show_crontab"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py crontab show {settings}'.format(**env))
Exemplo n.º 5
0
def create_superuser():
    """Create a django superuser: fab [environment] create_superuser"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py createsuperuser {settings}'.format(**env))
Exemplo n.º 6
0
def shell():
    """Open a shell: fab [environment] shell"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py shell_plus {settings}'.format(**env))
Exemplo n.º 7
0
def disable_debug():
    """Disable django debug mode: fab [environment] disable_debug"""
    with _venv(env.virtualenv_path):
        run("sed -i -e 's/DJANGO_DEBUG=True/DJANGO_DEBUG=False/' {path}/.env".
            format(**env))
    restart()
Exemplo n.º 8
0
def migrate():
    """Migrate the database: fab [environment] migrate"""
    with _venv(env.virtualenv_path):
        run("{path}/manage.py migrate {settings}".format(**env))
Exemplo n.º 9
0
def remove_crontab():
    """Remove the crontab entries: fab [environment] remove_crontab"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py crontab remove {settings}'.format(**env))
Exemplo n.º 10
0
def add_crontab():
    """Update the crontab entries: fab [environment] add_crontab"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py crontab add {settings}'.format(**env))
Exemplo n.º 11
0
def show_crontab():
    """Show the current crontab entries: fab [environment] show_crontab"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py crontab show {settings}'.format(**env))
Exemplo n.º 12
0
def create_superuser():
    """Create a django superuser: fab [environment] create_superuser"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py createsuperuser {settings}'.format(**env))
Exemplo n.º 13
0
def shell():
    """Open a shell: fab [environment] shell"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py shell_plus {settings}'.format(**env))
Exemplo n.º 14
0
def add_crontab():
    """Update the crontab entries: fab [environment] add_crontab"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py crontab add {settings}'.format(**env))
Exemplo n.º 15
0
def migrate():
    """Migrate the database: fab [environment] migrate"""
    with _venv(env.virtualenv_path):
        run("{path}/manage.py migrate {settings}".format(**env))
Exemplo n.º 16
0
def remove_crontab():
    """Remove the crontab entries: fab [environment] remove_crontab"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py crontab remove {settings}'.format(**env))
Exemplo n.º 17
0
def disable_debug():
    """Disable django debug mode: fab [environment] disable_debug"""
    with _venv(env.virtualenv_path):
        run("sed -i -e 's/DJANGO_DEBUG=True/DJANGO_DEBUG=False/' {path}/.env".format(**env))
    restart()