Created
February 3, 2013 00:08
-
-
Save hobson/4699850 to your computer and use it in GitHub Desktop.
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
# install pip & virtualenv | |
# create a virtual environment for your webapp | |
# install django in the new virtualenv | |
cd ~/tmp | |
PYVE=2.7 | |
PYVER=2.7.3 | |
STVER=0.6c11 | |
# go directly to the source to get the latest and greatest | |
wget http://pypi.python.org/packages/$PYVE/s/setuptools/setuptools-$STVER-py$PYVE.egg#md5=fe1f997bc722265116870bc7919059ea | |
# FIXME: find out if python should be system version or your new ~/local version | |
sh setuptools-$STVER-py$PYVE.egg --prefix=$HOME/local/Python-$PYVE | |
# not sure you want to trust an ISP's version of things | |
# wget http://peak.telecommunity.com/dist/ez_setup.py | |
# python ez_setup.py | |
easy_install pip | |
pip install virtualenv | |
# FIXME: better to put this in virtual-environment-wrapper's default, like ~/.venv/ | |
VENVNAME=tg | |
SITEURL=totalgood.com | |
virtualenv $HOME/$SITEURL/$VENVNAME | |
source $HOME/$SITEURL/$VENVNAME/bin/activate | |
echo "export PATH=\"$HOME/$SITEURL/$VENVNAME/bin:\$PATH\"" >> ~/.bashrc | |
source ~/.bashrc | |
echo "export PYTHONPATH=\"/home/hobson/local/Python-$PYVE/lib/python$PYVE" >> ~/.bashrc | |
PRJNAME=metastat | |
cd ~/$SITEURL | |
python $VENVNAME/bin/django-admin.py startproject $PRJNAME | |
echo ''' | |
import sys, os | |
cwd = os.getcwd() | |
sys.path.append(cwd) | |
sys.path.append(os.path.join(cwd, "'/$PRJNAME'") | |
if sys.version < "'$PYVER'": | |
os.execl("'$HOME/$SITEURL/$VENVNAME/bin/python'", "'python$PYVER'", *sys.argv) | |
sys.path.insert(0,"'$HOME/$SITEURL/$VENVNAME/bin'") | |
sys.path.insert(0,"'$HOME/$SITEURL/$VENVNAME/lib/python$PYVE/site-packages/django'") | |
sys.path.insert(0,"'$HOME/$SITEURL/$VENVNAME/lib/python$PYVE/site-packages'") | |
os.environ['DJANGO_SETTINGS_MODULE'] = "'$PRJNAME.settings'" | |
import django.core.handlers.wsgi | |
application = django.core.handlers.wsgi.WSGIHandler() | |
''' > $HOME/$SITEURL/passenger_wsgi.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment