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
}
|
More like this
- Command Line Script Launcher by dakrauth 3 years, 7 months ago
- Autoload Django Models When Using ./manage.py shell by sheats 4 years, 1 month ago
- Alternate method of autoloading Django models in ipython by drewr 4 years ago
- cron/console bootstrap django by nstrite 4 years, 5 months ago
- showing environment variables in the django admin by tonemcd 2 years ago
Comments