<commit_before>#!/bin/bash
localsettemp=/registry/dj-vercereg/dj_vercereg/dj_vercereg/local_settings_template.py
localset=/registry/dj-vercereg/dj_vercereg/dj_vercereg/local_settings.py
port=8000

# Local settings workflow / initializer

if [[ -f $localset && ! -L $localset ]]; then
	echo "Using custom local_settings.py..."
else
	if [ ! -L $localset ]; then
		echo "Creating local_settings_template.py link......"
		ln -s $localsettemp $localset
	else	
		echo "Using local_settings_template.py as local_settings.py, if you want to use custom settings you should create a custom local_settings.py file. Using local_settings_template.py as is, is not safe."
	fi
fi

# Registry db initializations

echo 'Initializing.....'

./manage.py makemigrations
./manage.py migrate
./manage.py migrate --run-syncdb

# Create superuser from localsettings
username=`cat $localset | grep USER | awk -F ":" '{print $2}'`
username=`sed -n "s/^.*'\(.*\)'.*$/\1/ p" <<< ${username}`

password=`cat $localset | grep PASSWORD | awk -F ":" '{print $2}'`
password=`sed -n "s/^.*'\(.*\)'.*$/\1/ p" <<< ${password}`

email=$username'@example.<EMAIL>'

echo 'Creating super user.....'

echo "from django.contrib.auth.models import User; User.objects.create_superuser($username, $email, $password)" | python manage.py shell

echo 'Fixtures....'

./manage.py loaddata fixtures/def_group.json

echo 'Starting web server....'

./manage.py runserver 0.0.0.0:$port<commit_msg>Dockerisation<commit_after>#!/bin/bash
localsettemp=/registry/dj-vercereg/dj_vercereg/dj_vercereg/local_settings_template.py
localset=/registry/dj-vercereg/dj_vercereg/dj_vercereg/local_settings.py
port=8000
dj_path=/registry/dj-vercereg/dj_vercereg

# Local settings workflow / initializer

if [[ -f $localset && ! -L $localset ]]; then
	echo "Using custom local_settings.py..."
else
	if [ ! -L $localset ]; then
		echo "Creating local_settings_template.py link......"
		ln -s $localsettemp $localset
	else	
		echo "Using local_settings_template.py as local_settings.py, if you want to use custom settings you should create a custom local_settings.py file. Using local_settings_template.py as is, is not safe."
	fi
fi

# Registry db initializations

echo 'Initializing.....'

python $dj_path/manage.py makemigrations
python $dj_path/manage.py migrate
python $dj_path/manage.py migrate --run-syncdb

# Create superuser from localsettings
username=`cat $localset | grep USER | awk -F ":" '{print $2}'`
username=`sed -n "s/^.*'\(.*\)'.*$/\1/ p" <<< ${username}`

password=`cat $localset | grep PASSWORD | awk -F ":" '{print $2}'`
password=`sed -n "s/^.*'\(.*\)'.*$/\1/ p" <<< ${password}`

email=$username'@example.<EMAIL>'

echo 'Creating super user.....'

echo "from django.contrib.auth.models import User; User.objects.create_superuser($username, $email, $password)" | python manage.py shell

echo 'Fixtures....'

python $dj_path/manage.py loaddata fixtures/def_group.json

echo 'Starting web server....'

python $dj_path/manage.py runserver 0.0.0.0:$port
{'fraction_non_alphanumeric': 0.16166666666666665, 'fraction_numerical': 0.008, 'mean_word_length': 4.264912280701754, 'pattern_counts': {'":': 4, '<': 17, '<?xml version=': 0, '>': 5, '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': '5753668', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1037, 'n_words': 265}