Skip to content

Instantly share code, notes, and snippets.

@jedie
Created April 24, 2012 09:54
Show Gist options
  • Save jedie/2478477 to your computer and use it in GitHub Desktop.
Save jedie/2478477 to your computer and use it in GitHub Desktop.
#!/bin/sh
# more info here: http://www.pylucid.org/permalink/410/runserversh
# use the local django packages
export PYTHONPATH=${PWD}
PORT='8000'
CHECK_DARWIN=`uname -a | awk '/Darwin/ {split ($1,A,":"); print A[1]}'`
CHECK_LINUX=`uname -a | awk '/Linux/ {split ($1,A,":"); print A[1]}'`
if [ ! -z $CHECK_DARWIN ]; then
echo 'found Darwin ...'
ADDR=`/sbin/ifconfig en0 | awk '/inet / {split ($2,A,":"); print A[1]}'`
fi
if [ ! -z $CHECK_LINUX ]; then
echo 'found Linux ...'
ADDR=`/sbin/ifconfig eth0 | awk '/inet Adr/ {split ($2,A,":"); print A[2]}'`
if [ ! $ADDR ]; then
echo "use eth1"
ADDR=`/sbin/ifconfig eth1 | awk '/inet Adr/ {split ($2,A,":"); print A[2]}'`
fi
fi
if [ $ADDR = "" ]; then
echo 'can not detect your IP-Adress use localhost'
ADDR=localhost
fi
echo '\nStarting django development server...\n'
echo '\nWARNING: Server will be available from external!\n'
export DJANGO_SETTINGS_MODULE=pylucid_project.settings
set -x
#./manage.py runserver $ADDR":$PORT" $* # django 1.3
./manage.py runserver --traceback --nostatic --insecure $ADDR":$PORT" $* # django 1.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment