Version 5 (modified by hvendelbo, 7 years ago) (diff)

--

You can run Django on PyPy, and it appears to be running reasonably well. By Django version 1.0 the current issues should have been resolved. For now you can get a project like Pinax from Django Hotclub up and running with a bit of extra work.

Check out PyPy

svn co http://codespeak.net/svn/pypy/dist pypy-dist

This checks out a pypy package and a py package(has py.test and other neat Python code) If you are using git to check out, check out the py repository separately or install py using easy_install.

PyPy runs on

  • Windows 32bit
  • Mac OS X Intel and PPC
  • Linux 32bit and 64bit

Build pypy-c

Don't try this on a weak machine. It must have at least 1Gb memory and a 5Gb swap space or it will do a lot of swapping. 2Gb is plenty. Expect it to take 30-60 minutes

cd pypy/translator/goal
./translate.py --thread --gc=hybrid --batch targetpypystandalone --faassen --allworkingmodules --oldstyle

This will create a pypy-c executable in the current directory. The generated interpreter will use the modified and standard Python libraries bundled with the PyPy source code if a runtime library is not already on the PYTHONPATH.

Platform prerequisites

To compile PyPy you need a couple of developer tools. Essentially,

  • Python 2.5 or 2.4 with ctypes
  • C Compiler (gcc or equivalent)
  • C Libraries
  • libbz2-dev
  • zlib-dev
  • libffi
  • python-dev

For Mac

Install Developer Tools Install MacPorts Install python25 and libffi via MacPorts

And you should be good to go

Check out Django

Do a subversion checkout of django trunk.

svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk

Currently the #6814 ticket is not resolved, so you need to apply the patch from #6857 to make robustapply work. Without the patch signals will blow up showing obscure import errors.

Once Django 1.0 is out, it should run on PyPy out of the box.

Python 2.4

PyPy supports the 2.4 runtime library, so you have to be aware of code using 2.5 features.

Django only requires Python 2.3. So as such Django runs just fine on PyPy. But, be aware that many popular django applications depend on Python 2.5 runtime lib.

Getting the Pinax Django Hotclub project running we needed a couple of extra dependencies,

  • elementtree
  • hashlib

But these have now been included in PyPy during the EuroPython sprint (well done hpk & hruske).

If you try to run Pinax on cPython 2.4 you would have this dependency problem.

Pinax Project

If you want to get the Pinax project up and running you need to check out the trunk

svn checkout http://django-hotclub.googlecode.com/svn/trunk/ django-hotclub

This checks out pinax and all the associated applications from Google Code. If you want to check out with git follow the instructions on the project wiki at

http://code.google.com/p/django-hotclub/wiki/UsingGit

Run Django

Make a link to pypy-c in /usr/shared/bin

pypy-c ./manage.py runserver --noreload
}}
Back to Top