|Version 12 (modified by fijal, 8 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
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
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 (default)
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.
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
For testing you probably use sqlite for the database. Make sure you have the proper database client software installed.
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
Django does not need to be modified in order to run on top of PyPy.
PyPy supports the 2.4 runtime library (although the work is underway to improve the situation), 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,
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
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
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.