Created
June 13, 2011 17:16
-
-
Save starenka/1023218 to your computer and use it in GitHub Desktop.
symlinks all django static files to lighttpd root
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
LIGHTTPD_ROOT='/django/__proxy__/' | |
DIRS=( "static" "site_media" "site-media" ) | |
OK_COLOR="\e[0;32m" | |
INFO_COLOR="\e[1;33m" | |
RESET="\033[0;0m" | |
echo -e "$INFO_COLOR Checking symlinks...$RESET" | |
for d in ${DIRS[@]} | |
do | |
if [ -L "$LIGHTTPD_ROOT$d" ]; then | |
echo -e "$OK_COLOR Found symlinked item \"$d\"$RESET" | |
if [ `readlink "$LIGHTTPD_ROOT$d"` != "$PWD/$d" ]; then | |
echo -e "$INFO_COLOR Symlink links to another dir. Removing it & linking to $PWD/$d$RESET" | |
rm "$LIGHTTPD_ROOT$d" | |
ln -s "$PWD/$d" "$LIGHTTPD_ROOT$d" | |
else | |
echo -e "$OK_COLOR Symlink OK$RESET" | |
fi | |
else | |
echo " \"$d\" is not a symlink, trying to create it" | |
ln -s "$PWD/$d" "$LIGHTTPD_ROOT$d" | |
fi | |
done | |
echo -e "$INFO_COLOR Starting Django dev server...$RESET" | |
python ./manage.py runserver 8001 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment