<commit_before># coding: utf-8

from os import environ
from fabric.api import env, cd, local
from fabric.colors import yellow, green


REPOSITORY = '<EMAIL>:luanfonceca/speakerfight.git'
REMOTE = 'origin'
BRANCH = 'master'
env.hosts = ['speakerfight.com']
env.user = 'root'
env.password = environ.get('PASSWORD')
env.shell = '/bin/rbash -l -c'
env.app_dir = '/home/speakerfight'
env.project_name = 'speakerfight'
env.virtualenv_dir = '/home/virtualenv'


def _run(command, pip='python'):
    local('{venv}/bin/{target} {command}'.format(
        venv=env.virtualenv_dir,
        project_name=env.project_name,
        command=command,
        target=pip))


def _update_app():
    with cd(env.app_dir):
        print yellow('Fetch the Code')
        local('git pull {remote} {branch}'.format(
            remote=REMOTE,
            branch=BRANCH))

        print yellow('Update the Python Requirements')
        _run('install -r requirements.txt --quiet', 'pip')

        print yellow('Cleanning the .pyc files')
        _run('manage.py clean_pyc')

        print yellow('Migrate the DB')
        _run('manage.py syncdb --migrate --noinput --verbosity=0')

        print yellow('Collecting the static files')
        _run('manage.py collectstatic --noinput --verbosity=0')

        print green('App succefully updated')


def _restart_app():
    print yellow('Restart the Uwsgi')
    local('service uwsgi restart')

    print yellow('Restart the Nginx')
    local('service nginx restart')

    print green('Services succefully restarted')


def deploy():
    _update_app()
    _restart_app()
    print green('Deploy succefully done!')


def load_initial_data():
    fixtures = [
        'deck/fixtures/user.json',
        'deck/fixtures/event.json',<commit_msg>Trying to fix the fabric.<commit_after># coding: utf-8

from os import environ
from fabric.api import env, cd, local, run, sudo
from fabric.colors import yellow, green


REPOSITORY = '<EMAIL>:luanfonceca/speakerfight.git'
REMOTE = 'origin'
BRANCH = 'master'
env.hosts = ['speakerfight.com']
env.user = 'root'
env.password = environ.get('PASSWORD')
# env.shell = '/bin/rbash -l -c'
env.app_dir = '/home/speakerfight'
env.project_name = 'speakerfight'
env.virtualenv_dir = '/home/virtualenv'


def _run(command, pip='python'):
    sudo('{venv}/bin/{target} {command}'.format(
        venv=env.virtualenv_dir,
        project_name=env.project_name,
        command=command,
        target=pip))


def _update_app():
    with cd(env.app_dir):
        print yellow('Fetch the Code')
        local('git pull {remote} {branch}'.format(
            remote=REMOTE,
            branch=BRANCH))

        print yellow('Update the Python Requirements')
        _run('install -r requirements.txt --quiet', 'pip')

        print yellow('Cleanning the .pyc files')
        _run('manage.py clean_pyc')

        print yellow('Migrate the DB')
        _run('manage.py syncdb --migrate --noinput --verbosity=0')

        print yellow('Collecting the static files')
        _run('manage.py collectstatic --noinput --verbosity=0')

        print green('App succefully updated')


def _restart_app():
    print yellow('Restart the Uwsgi')
    sudo('service uwsgi restart')

    print yellow('Restart the Nginx')
    sudo('service nginx restart')

    print green('Services succefully restarted')


def deploy():
    _update_app()
    _restart_app()
    print green('Deploy succefully done!')


def load_initial_data():
    fixtures = [
        'deck/fixtures/user.json',
        'deck/fixtures/event.json',
{'fraction_non_alphanumeric': 0.13318284424379231, 'fraction_numerical': 0.001693002257336343, 'mean_word_length': 3.146198830409357, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '850900', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1126, 'n_words': 275}