<commit_before>#! /bin/bash

# Activate virtual environment
source /root/.venv/django/bin/activate

export HOSTNAME=`cat /etc/hostname`

# Django variables from Dockerfile and/or docker run: 
# PROJECT_NAME, PORT, SETTINGS_MODULE
# POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, POSTGRES_HOST, POSTGRES_PORT

export PROJECTDIR=/root/$PROJECT_NAME
export DJANGO_SETTINGS_MODULE=$PROJECT_NAME.settings.$SETTINGS_MODULE

#  replace to use variables used by postgres Docker image

export PROJECT_DATABASES_ENGINE=postgresql
export PROJECT_DATABASES_DEFAULT_NAME=$POSTGRES_DB
export PROJECT_DATABASES_DEFAULT_USER=$POSTGRES_USER
export PROJECT_DATABASES_DEFAULT_PASSWORD=$POSTGRES_PASSWORD

export PROJECT_DATABASES_DEFAULT_HOST=$POSTGRES_HOST
export PROJECT_DATABASES_DEFAULT_PORT=$POSTGRES_PORT

export PROJECT_REDIS_HOST=$REDIS_HOST
export PROJECT_REDIS_PORT=$REDIS_PORT

cd $PROJECTDIR

# Install editable applications from mounted volume if required
python -c 'import znbcache' 
if [ $? -eq 1 ]; then
	pip install --requirement /tmp/editable-requirements.txt
fi

if [ "$1" == "development" ]; then
	export PROJECT_RUNNING_DEV=true
	exec gosu root django-admin runserver --pythonpath=$(pwd) 0.0.0.0:$PORT
elif [ "$1" == "production" ]; then
	export PROJECT_RUNNING_DEV=false
	export USER=root
    	export GROUP=root
	export NUM_WORKERS=3
	export BIND_HOST=$HOSTNAME<commit_msg>set default for PROJECT_RUNNING_DEV<commit_after>#! /bin/bash

# Activate virtual environment
source /root/.venv/django/bin/activate

export HOSTNAME=`cat /etc/hostname`

# Django variables from Dockerfile and/or docker run: 
# PROJECT_NAME, PORT, SETTINGS_MODULE
# POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, POSTGRES_HOST, POSTGRES_PORT

export PROJECTDIR=/root/$PROJECT_NAME
export DJANGO_SETTINGS_MODULE=$PROJECT_NAME.settings.$SETTINGS_MODULE

#  replace to use variables used by postgres Docker image

export PROJECT_DATABASES_ENGINE=postgresql
export PROJECT_DATABASES_DEFAULT_NAME=$POSTGRES_DB
export PROJECT_DATABASES_DEFAULT_USER=$POSTGRES_USER
export PROJECT_DATABASES_DEFAULT_PASSWORD=$POSTGRES_PASSWORD

export PROJECT_DATABASES_DEFAULT_HOST=$POSTGRES_HOST
export PROJECT_DATABASES_DEFAULT_PORT=$POSTGRES_PORT

export PROJECT_RUNNING_DEV=true

export PROJECT_REDIS_HOST=$REDIS_HOST
export PROJECT_REDIS_PORT=$REDIS_PORT

cd $PROJECTDIR

# Install editable applications from mounted volume if required
python -c 'import znbcache' 
if [ $? -eq 1 ]; then
	pip install --requirement /tmp/editable-requirements.txt
fi

if [ "$1" == "development" ]; then
	exec gosu root django-admin runserver --pythonpath=$(pwd) 0.0.0.0:$PORT
elif [ "$1" == "production" ]; then
	export PROJECT_RUNNING_DEV=false
	export USER=root
	export GROUP=root
	export NUM_WORKERS=3
	export BIND_HOST=$HOSTNAME
{'fraction_non_alphanumeric': 0.08014440433212996, 'fraction_numerical': 0.005776173285198556, 'mean_word_length': 7.008670520231214, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6510179', 'n_tokens_mistral': 991, 'n_tokens_neox': 959, 'n_words': 210}