Beispiel #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()
Beispiel #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()
Beispiel #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))
Beispiel #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))
Beispiel #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))
Beispiel #6
0
def shell():
    """Open a shell: fab [environment] shell"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py shell_plus {settings}'.format(**env))
Beispiel #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()
Beispiel #8
0
def migrate():
    """Migrate the database: fab [environment] migrate"""
    with _venv(env.virtualenv_path):
        run("{path}/manage.py migrate {settings}".format(**env))
Beispiel #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))
Beispiel #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))
Beispiel #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))
Beispiel #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))
Beispiel #13
0
def shell():
    """Open a shell: fab [environment] shell"""
    with _venv(env.virtualenv_path):
        run('{path}/manage.py shell_plus {settings}'.format(**env))
Beispiel #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))
Beispiel #15
0
def migrate():
    """Migrate the database: fab [environment] migrate"""
    with _venv(env.virtualenv_path):
        run("{path}/manage.py migrate {settings}".format(**env))
Beispiel #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))
Beispiel #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()