<commit_before>import os

from fabric.api import run, env, settings, cd, put, sudo
from fabric.contrib import files

import private

GIT_REPO = 'git://github.com/lextoumbourou/lextoumbourou.com.git'

def prod():
    env.hosts = list(private.PROD_SERVERS)


def local():
    env.hosts = ['localhost']


def initial_build():
    """
    Clone project and set permissions
    """
    # Clone project if it doesn't exist
    with settings(warn_only=True):
        if run('test -d {0}'.format(private.APP_DIR)).failed:
            run('git clone {0} {1}'.format(GIT_REPO, private.APP_DIR))

    # Make sure permissions are correct
    sudo('chown -R {0} {1}'.format(private.USER_GROUP, private.APP_DIR))
    sudo('chmod -R 775 {0}'.format(private.APP_DIR))


def deploy():
    """
    Deploy code to production
    """
    initial_build()

    # Perform Django app deployment tasks
    with cd(private.APP_DIR):
        run('git pull')
        put('private.py', 'lextoumbourou/private.py')
        run('python manage.py syncdb')
        run('python manage.py collectstatic --noinput')<commit_msg>Python commands now run in virtualenv<commit_after>import os

from fabric.api import run, env, settings, cd, put, sudo
from fabric.contrib import files

import private

GIT_REPO = 'git://github.com/lextoumbourou/lextoumbourou.com.git'

def prod():
    env.hosts = list(private.PROD_SERVERS)


def local():
    env.hosts = ['localhost']


def initial_build():
    """
    Clone project and set permissions
    """
    # Clone project if it doesn't exist
    with settings(warn_only=True):
        if run('test -d {0}'.format(private.APP_DIR)).failed:
            run('git clone {0} {1}'.format(GIT_REPO, private.APP_DIR))

    # Make sure permissions are correct
    sudo('chown -R {0} {1}'.format(private.USER_GROUP, private.APP_DIR))
    sudo('chmod -R 775 {0}'.format(private.APP_DIR))


def deploy():
    """
    Deploy code to production
    """
    initial_build()

    # Perform Django app deployment tasks
    with cd(private.APP_DIR):
        run('git pull')
        put('private.py', 'lextoumbourou/private.py')
        run('./python-env/bin/python manage.py syncdb')
        run('./python-env/bin/python manage.py collectstatic --noinput')
{'fraction_non_alphanumeric': 0.13660714285714284, 'fraction_numerical': 0.008035714285714285, 'mean_word_length': 3.1809701492537314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2453178', 'n_tokens_mistral': 756, 'n_tokens_neox': 728, 'n_words': 184}