22 lines
553 B
Bash
22 lines
553 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
# run a script in the context of the django project
|
||
|
|
||
|
export DJANGO_DEBUG="true"
|
||
|
|
||
|
if [ -z $2 ]; then
|
||
|
|
||
|
echo "Missing second argument <path>: the path to the script"
|
||
|
|
||
|
else
|
||
|
|
||
|
oldcwd="$(pwd)"
|
||
|
script_path=$2
|
||
|
echo "Starting $2 in a django shell:"
|
||
|
echo -e "--------------------------------------------------------------------------------\n"
|
||
|
cat "$script_path" | "$(pwd)/application/manage.py" shell
|
||
|
echo -e "\n--------------------------------------------------------------------------------"
|
||
|
cd "$oldcwd"
|
||
|
|
||
|
fi
|