1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # For a monolithic project, just run the function from the project folder.
#
# For a reusable app, run the function from the folder containing the settings
# file, and pass the settings file as an argument.
# E.g. ``djsetup somecoolsite_settings.py``
djsetup()
{
if [ x"$1" != x ]; then
export PYTHONPATH=$PWD
export DJANGO_SETTINGS_MODULE=$(basename $1 .py)
else
cd ..
export PYTHONPATH=$PWD
export DJANGO_SETTINGS_MODULE=$(basename $OLDPWD).settings
cd $OLDPWD
fi
}
|
Comments