<commit_before>#!/bin/bash

function postgres_ready(){
python << END
import sys
import psycopg2
try:
    conn = psycopg2.connect(dbname="postgres", user="postgres", host="postgres")
except psycopg2.OperationalError:
    sys.exit(-1)
sys.exit(0)
END
}

until postgres_ready; do
  >&2 echo "Postgres is unavailable - sleeping"
  sleep 1
done

>&2 echo "Postgres is up - continuing..."

# Apply database migrations
echo "Apply database migrations"
python3 manage.py migrate

# Load topics content
echo "Load topics content"
python3 manage.py updatedata

# Start gunicorn service
echo "Starting gunicorn"
gunicorn -c gunicorn.conf.py -b :$PORT config.wsgi
<commit_msg>Alter gunicorn to automatically update on Python code changes<commit_after>#!/bin/bash

function postgres_ready(){
python << END
import sys
import psycopg2
try:
    conn = psycopg2.connect(dbname="postgres", user="postgres", host="postgres")
except psycopg2.OperationalError:
    sys.exit(-1)
sys.exit(0)
END
}

until postgres_ready; do
  >&2 echo "Postgres is unavailable - sleeping"
  sleep 1
done

>&2 echo "Postgres is up - continuing..."

# Apply database migrations
echo "Apply database migrations"
python3 manage.py migrate

# Load topics content
echo "Load topics content"
python3 manage.py updatedata

# Start gunicorn service
echo "Starting gunicorn"
gunicorn -c gunicorn.conf.py -b :$PORT config.wsgi --reload

{'fraction_non_alphanumeric': 0.10252707581227437, 'fraction_numerical': 0.01444043321299639, 'mean_word_length': 4.775, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4613137', 'n_tokens_mistral': 460, 'n_tokens_neox': 438, 'n_words': 147}