Skip to content

Instantly share code, notes, and snippets.

@marklit
Created August 10, 2011 16:09
Show Gist options
  • Save marklit/1137293 to your computer and use it in GitHub Desktop.
Save marklit/1137293 to your computer and use it in GitHub Desktop.
Django site setup cheat sheet
$ export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
$ sudo easy_install setuptools
$ wget http://pypi.python.org/packages/source/p/pip/pip-0.6.3.tar.gz
$ tar xzf pip-0.6.3.tar.gz
$ cd pip-0.6.3
$ sudo python setup.py install
$ sudo pip install virtualenv virtualenvwrapper
$ cat ~/.bashrc
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
export PYTHONPATH=[location-of-django-applications]
alias v=workon
alias v.deactivate=deactivate
alias v.mk='mkvirtualenv --no-site-packages'
alias v.mk_withsitepackages='mkvirtualenv'
alias v.rm=rmvirtualenv
alias v.switch=workon
alias v.add2virtualenv=add2virtualenv
alias v.cdsitepackages=cdsitepackages
alias v.cd=cdvirtualenv
alias v.lssitepackages=lssitepackages
$ source ~/.bashrc
$ cd ~/.virtualenvs
$ virtualenv --no-site-packages test
$ cd test
$ source bin/activate
$ pip install gunicorn django MySQL-Python
$ django-admin.py startproject hello
$ cd hello
# to test the base setup works
$ python manage.py runserver 0.0.0.0:8000
$ gunicorn_django -b 0.0.0.0:8000
@marklit
Copy link
Author

marklit commented Aug 22, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment