#!/usr/bin/env bash

SETTINGS_FILE=$(find . -maxdepth 3 -type f -name 'settings.py' | head -1)
PROJECT=$(dirname $SETTINGS_FILE)
MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1)
MANAGE_FILE=${MANAGE_FILE:2}

# Disable injection for new applications.
if [ -f .heroku/injection_disabled ]; then
  DISABLE_INJECTION=1
fi

export SETTINGS_FILE MANAGE_FILE PROJECT DISABLE_INJECTION

echo " !     Notice: settings injection will be deprecated for all new Django "
echo " !     apps next month. You can prepapre your application for information on the new usage:"
echo " !     https://devcenter.heroku.com/articles/django#database_settings"

if [ ! "$DISABLE_INJECTION" ]; then
    source $BIN_DIR/steps/django/injection
fi

if [ ! "$DISABLE_COLLECTSTATIC" ]; then
    source $BIN_DIR/steps/django/collectstatic
fi

