<commit_before>from fabric.api import *
from datetime import datetime
env.hosts = ['fscons.org']

@task(default=True)
def deploy():
    local("git push zjyto")
    code_dir = '/var/django/myconf'
    with cd(code_dir):
        run("git pull origin master")
        run("python manage.py collectstatic --noinput")
        sudo("/etc/init.d/apache2 restart")

@task(alias="refresh")
def refresh_initial_data():
    code_dir = '/var/django/myconf'
    fname = "initial_data_%s.json" % datetime.now().strftime("%Y%m%d%H%M")
    with cd(code_dir):
        run("python manage.py dumpdata signup schedule people restaurants > %s" % fname)
        get(fname, "fixtures")
<commit_msg>Updating the deployment routine for the new server<commit_after>from fabric.api import *
from datetime import datetime
from fabric.contrib import files, console
from fabric.contrib.project import rsync_project
from fabric import utils
import os

env.hosts = ['172.16.31.10']
env.user = 'gdetrez'
env.root = '/srv/fscons.org'
env.virtualenv_root = '/srv/fscons.org/env'

RSYNC_EXCLUDE = (
    '.DS_Store',
    '.git',
    'env',
    '*.pyc',
    '*.db',
    '*~',
    'local_settings.py',
    'fabfile.py',
    'bootstrap.py',
)

@task(default=True)
def deploy():
    """ rsync code to remote host """
    if not console.confirm('Are you sure you want to deploy production?',
                           default=False):
        utils.abort('Production deployment aborted.')
    extra_opts = '--omit-dir-times'
    rsync_project(
        env.root,
        exclude=RSYNC_EXCLUDE,
        delete=True,
        extra_opts=extra_opts,
    )
    touch()

def touch():
    """ touch wsgi file to trigger reload """
    #require('code_root', provided_by=('staging', 'production'))
    apache_dir = os.path.join(env.root, 'myconf', 'apache')
    with cd(apache_dir):
        run('touch staging.wsgi')
{'fraction_non_alphanumeric': 0.14431330472103004, 'fraction_numerical': 0.00536480686695279, 'mean_word_length': 3.1722595078299776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '1002858', 'n_tokens_mistral': 624, 'n_tokens_neox': 608, 'n_words': 145}