Code


Version 3 (modified by hvendelbo, 6 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 or it will do a lot of swapping. 2Gb is plenty. Expect it to take 30-60 minutes

cd pypy/translator/goals
./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. Or get version 1.0 that has the signals speedup (ticket 6814) Or if ticket 6814 is not in yet, apply patch ticket 6857 (http://code.djangoproject.com/ticket/6857)

Python 2.4

Django only requires Python 2.3. But, be aware that many popular django applications depend on Python 2.5 runtime lib.

  • elementtree (from xml.etree import cElementTree as ElementTree) python-openid yadis gdata

  • hashlib python-openid gravatar

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

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