<commit_before>#!/usr/bin/env bash
# This script will deploy the latest code to production.
# This script does NOT apply migrations. Do those yourself carefully.
set -x
HOME=/home/sigmapiwpi
DJANGOAPP=sigmapiweb
STATIC=static

DEPLOY_UTILS=$HOME/deploy
REPO=$DEPLOY_UTILS/sigmapi-web-repo
REPO_SCRIPTS=$REPO/scripts
PROD=$HOME/webapps
PROD_SCRIPTS=$HOME/scripts

PROD_PYTHON_WEBAPP=$PROD/sigma_pi_web_2
PROD_STATIC_WEBAPP=$PROD/sigma_pi_web_static

ENV_SETTINGS_DIR=common/settings
ENV_SETTINGS_SRC_FNAME=prod.py
ENV_SETTINGS_DST_FNAME=prod.py

PYTHON=python3.6
DJANGO_LIB=Django-1.11.18-py3.6.egg/django
PIP=pip3.6

echo "Copying REPO $REPO/$DJANGOAPP TO PROD $PROD_PYTHON_WEBAPP/$DJANGOAPP";
cp -rf $REPO/$DJANGOAPP $PROD_PYTHON_WEBAPP;
echo "";

echo "Installing Python dependencies:";
pip3.6 install --user -r $PROD_PYTHON_WEBAPP/$DJANGOAPP/requirements/prod.txt;
echo "";

echo "Copying production environment settings file:"
rm -rf $PROD_PYTHON_WEBAPP/$DJANGOAPP/$ENV_SETTINGS_DIR/$ENV_SETTINGS_DST_FNAME;
cp $DEPLOY_UTILS/$ENV_SETTINGS_SRC_FNAME $PROD_PYTHON_WEBAPP/$DJANGOAPP/$ENV_SETTINGS_DIR/$ENV_SETTINGS_DST_FNAME;
echo "";

echo "Copying REPO $REPO/$DJANGOAPP/$STATIC TO PROD $PROD_STATIC_WEBAPP";
rm -rf $PROD_STATIC_WEBAPP/*;
cd $PROD_PYTHON_WEBAPP/$DJANGOAPP;
make static_prod;
#rm -rf $PROD_PYTHON_WEBAPP/$DJANGOAPP/$STATIC;
echo "";

echo "Copy scripts from $REPO_SCRIPTS to $PROD_SCRIPTS";
rm -rf $PROD_SCRIPTS/*
cp $REPO_SCRIPTS/* $PROD_SCRIPTS
chmod +x $PROD_SCRIPTS/*
echo "";

echo "Copying admin panel static files.";
cp -r $PROD_PYTHON_WEBAPP/lib/$PYTHON/$DJANGO_LIB/contrib/admin/static/admin $PROD_STATIC_WEBAPP/;
echo "";

echo "Restarting server...";
$PROD_PYTHON_WEBAPP/apache2/bin/restart;
echo ""

echo "Server restarted.";<commit_msg>Remove old make usage<commit_after>#!/usr/bin/env bash
# This script will deploy the latest code to production.
# This script does NOT apply migrations. Do those yourself carefully.
set -x
HOME=/home/sigmapiwpi
DJANGOAPP=sigmapiweb
STATIC=static

DEPLOY_UTILS=$HOME/deploy
REPO=$DEPLOY_UTILS/sigmapi-web-repo
REPO_SCRIPTS=$REPO/scripts
PROD=$HOME/webapps
PROD_SCRIPTS=$HOME/scripts

PROD_PYTHON_WEBAPP=$PROD/sigma_pi_web_2
PROD_STATIC_WEBAPP=$PROD/sigma_pi_web_static

ENV_SETTINGS_DIR=common/settings
ENV_SETTINGS_SRC_FNAME=prod.py
ENV_SETTINGS_DST_FNAME=prod.py

PYTHON=python3.6
DJANGO_LIB=Django-1.11.18-py3.6.egg/django
PIP=pip3.6

echo "Copying REPO $REPO/$DJANGOAPP TO PROD $PROD_PYTHON_WEBAPP/$DJANGOAPP";
cp -rf $REPO/$DJANGOAPP $PROD_PYTHON_WEBAPP;
echo "";

echo "Installing Python dependencies:";
pip3.6 install --user -r $PROD_PYTHON_WEBAPP/$DJANGOAPP/requirements/prod.txt;
echo "";

echo "Copying production environment settings file:"
rm -rf $PROD_PYTHON_WEBAPP/$DJANGOAPP/$ENV_SETTINGS_DIR/$ENV_SETTINGS_DST_FNAME;
cp $DEPLOY_UTILS/$ENV_SETTINGS_SRC_FNAME $PROD_PYTHON_WEBAPP/$DJANGOAPP/$ENV_SETTINGS_DIR/$ENV_SETTINGS_DST_FNAME;
echo "";

echo "Copying REPO $REPO/$DJANGOAPP/$STATIC TO PROD $PROD_STATIC_WEBAPP";
rm -rf $PROD_STATIC_WEBAPP/*;
cd $PROD_PYTHON_WEBAPP/$DJANGOAPP;
$PYTHON devl.py static_prod;
#rm -rf $PROD_PYTHON_WEBAPP/$DJANGOAPP/$STATIC;
echo "";

echo "Copy scripts from $REPO_SCRIPTS to $PROD_SCRIPTS";
rm -rf $PROD_SCRIPTS/*
cp $REPO_SCRIPTS/* $PROD_SCRIPTS
chmod +x $PROD_SCRIPTS/*
echo "";

echo "Copying admin panel static files.";
cp -r $PROD_PYTHON_WEBAPP/lib/$PYTHON/$DJANGO_LIB/contrib/admin/static/admin $PROD_STATIC_WEBAPP/;
echo "";

echo "Restarting server...";
$PROD_PYTHON_WEBAPP/apache2/bin/restart;
echo ""

echo "Server restarted.";
{'fraction_non_alphanumeric': 0.1187728679988742, 'fraction_numerical': 0.008443568815085843, 'mean_word_length': 6.726086956521739, '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': '4847292', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1532, 'n_words': 259}