Solutions Log

So I only have to figure things out once.

Install and Use Django, MySQL, and VirtualEnv on Snow Leopard

Django

mkdir -p ~/src
svn co http://code.djangoproject.com/svn/django/trunk/ ~/src/django
ln -s ~/src/django/django `python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`/django
ln -s ~/src/django/django/bin/django-admin.py ~/bin/django-admin.py

PIP, mysql-python, virtualenv, virtualenvwrapper, Mercurial

Download and install the MySQL package installer, then:

easy_install pip
pip install http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz?use_mirror=cdnetworks-us-2
pip install virtualenv
pip install virtualenvwrapper
pip install mercurial

(Note: we’re installing Mercurial because a lot of PIP packages require it)

In ~/bin/dotfiles/bash/env

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
. ~/src/django/extras/django_bash_completion

Then

mkdir -p ~/.virtualenvs
source ~/.bashrc

Install libjpeg from scratch (for PIL):

cd ~/src
curl -O http://www.ijg.org/files/jpegsrc.v8a.tar.gz
tar zxvf jpegsrc.v8a.tar.gz
cd jpeg-8a
./configure
make
make install

Setup a project

cd [path/to/your/project/]
mkvirtualenv [projectname]
add2virtualenv .
echo 'cd [path/to/your/project/]' >> $WORKON_HOME/postactivate

Put requirements for your project into a requirements.txt like so:

A package on its own line:

docutils==0.6

Repo noted like so:

-e git://github.com/mintchaos/typogrify.git#egg=Typogrify

To install things in your requirements file

pip install -r requirements.txt

Starting and Stopping VirtualEnvs

Start:

workon [project]

Stop:

deactivate

Sources

Comments