Created
October 24, 2011 16:10
-
-
Save alexcabrera/1309399 to your computer and use it in GitHub Desktop.
link django's static and media directories for use with nginx during development
This file contains hidden or 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
| #! /bin/bash | |
| # Script to symlink static and media directories active.lo, served by nginx | |
| export NGINX_STATIC_DIR=/usr/local/www/active.lo/static | |
| export NGINX_MEDIA_DIR=/usr/local/www/active.lo/media | |
| if [ -d "$PWD/static" ] | |
| then | |
| if [ -h $NGINX_STATIC_DIR ] | |
| then | |
| rm $NGINX_STATIC_DIR | |
| fi | |
| ln -s "$PWD/static" $NGINX_STATIC_DIR | |
| # echo $NGINX_STATIC_DIR | |
| echo "Symlinked $PWD/static to $NGINX_STATIC_DIR" | |
| fi | |
| if [ -d "$PWD/media" ] | |
| then | |
| if [ -h $NGINX_MEDIA_DIR ] | |
| then | |
| rm $NGINX_MEDIA_DIR | |
| fi | |
| ln -s "$PWD/media" $NGINX_MEDIA_DIR | |
| echo "Symlinked $PWD/media to $NGINX_MEDIA_DIR" | |
| fi% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment