Version 9 (modified by Henrik Vendelbo, 16 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 2+Gb 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.

  • Python Language
  • Thread support
  • Hybrid generational style garbage collector
  • All optimisations
  • All working modules
  • Support old style classes style as done in Python 2.5

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.

Now copy or link the pypy-c executable to a place that is on your PATH, such as:

ln pypy-c /opt/local/bin

You should now be able to run pypy-c from any directory. Try it to make sure it works. It will give you a warning about using compiled-in library path. That is ok. What this means is that it is using path default that may only work on your machine.

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.

Also be on the lookout for dependency on PIL, which is not currently ported to ctypes

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

Switch to the Pinax project directory and run the development server

pypy-c ./manage.py syncdb
pypy-c ./manage.py runserver --noreload

Reloading doesn't seem to be working properly at the moment, so you need to disable it.

Note: See TracWiki for help on using the wiki.
Back to Top