Django 1.5, Python 3.3, and Virtual Environments

Today I wanted to tinker around with the experimental support for Python 3 in Django 1.5 (alpha). So, my first question was, how well does virtualenv play with Python 3? And that's when I learned about the new(ish) venv module available in Python 3.3. The history and inclusion of virtual environments in Python is outlined in PEP 405.

Since I run Fedora 17 which ships with Python 3.2, Python 3.3 had to be installed from source. I installed it into my home .local directory.

wget http://www.python.org/ftp/python/3.3.0/Python-3.3.0.tgz
tar -xzf Python-3.3.0.tgz
cd Python-3.3.0
./configure --prefix=~/.local --exec-prefix=~/.local
make
make install

The pyvenv script works much like virtualenv. Since I was setting up a virtual environment for testing Django 1.5, I called my virtual environment "django15".

~/.local/bin/pyvenv django15
cd django15
source bin/activate

Once the virtual environment is activated, distribute can be installed followed by pip.

curls -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip

Since Django 1.5 is still in alpha, it is installed from a tarball.

wget -O Django-1.5a1.tar.gz https://www.djangoproject.com/download/1.5a1/tarball/
tar xzvf Django-1.5a1.tar.gz
cd Django-1.5a1
python3 setup.py install

While it may be some time yet before I can run Django on Python 3 in a production evironment, at least I can start experimenting and thinking about the future.

Did you enjoy Django 1.5, Python 3.3, and Virtual Environments? If you would like to help support my work, A donation of a buck or two would be very much appreciated.
blog comments powered by Disqus
Linux Servers on the Cloud IN MINUTES