Changes between Version 17 and Version 18 of DjangoAndPyPy


Ignore:
Timestamp:
Feb 8, 2011, 10:31:20 PM (14 years ago)
Author:
TryPyPy
Comment:

Update: Django works fine with PyPy now, instructions for getting each better left for install pages.

Legend:

Unmodified
Added
Removed
Modified
  • DjangoAndPyPy

    v17 v18  
    1 ''This contains outdated info about compile time and memory requirements, Python version support, limitations, etc.''
     1Running Django on [[http://pypy.org/ | PyPy]] boils down to installing both and running Django with `pypy` instead of `python`.
    22
    3 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.
    4 For now you can get a project like Pinax from Django Hotclub up and running with a bit of extra work.
     3Download a [[http://pypy.org/ | PyPy]] binary from http://pypy.org/download.html and follow the install instructions there.
    54
    6 == Download a PyPy binary ==
    7 http://pypy.org/download.html
    8 
    9 == Check out PyPy ==
    10 If downloading a binary doesn't work for you, you can check out and build PyPy yourself.
    11 
     5Run Django the usual way with [[http://pypy.org/ | PyPy]]:
    126{{{
    13 svn co http://codespeak.net/svn/pypy/dist pypy-dist
    14 }}}
    15 This checks out a pypy package and a py package(has py.test and other neat Python code)
    16 If you are using git to check out, check out the py repository separately or install py using easy_install.
    17 
    18 PyPy runs on
    19  * Windows 32bit
    20  * Mac OS X Intel and PPC
    21  * Linux 32bit and 64bit
    22 
    23 == Build pypy-c ==
    24 
    25 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.
    26 Expect it to take 30-60 minutes
    27 {{{
    28 cd pypy/translator/goal
    29 ./translate.py --batch --opt=3
    30 }}}
    31 This will create a pypy-c executable in the current directory.
    32  * Python Language
    33  * Thread support
    34  * Hybrid generational style garbage collector
    35  * All optimisations
    36  * All working modules
    37  * Support old style classes style as done in Python 2.5 (default)
    38  
    39 The generated interpreter will use the modified
    40 and standard Python libraries bundled with the PyPy source code if a runtime library is not already on the PYTHONPATH.
    41 
    42 Now copy or link the pypy-c executable to a place that is on your PATH, such as:
    43 {{{
    44 ln -s pypy-c /opt/local/bin
     7pypy ./manage.py syncdb
     8pypy ./manage.py runserver
    459}}}
    4610
    47 You should now be able to run pypy-c from any directory. Try it to make sure it works.
    48 In the example above we made a symlink; if you make a copy instead, the copy will give you a warning about using compiled-in library path. That is ok. What this means is
    49 that it is using path default that may only work on your machine.
     11[[http://pypy.org/ | PyPy]]
     12[[http://speed.pypy.org/timeline/?ben=django|runs the templating engine faster]]
     13than CPython, but so far DB access is slower for some drivers.
    5014
    51 === Platform prerequisites ===
    52 
    53 To compile PyPy you need a couple of developer tools. Essentially,
    54  * Python 2.5 or 2.4 with ctypes
    55  * C Compiler (gcc or equivalent)
    56  * C Libraries
    57  * libbz2-dev
    58  * zlib-dev
    59  * libffi
    60  * python-dev
    61 
    62 For testing you probably use sqlite for the database. Make sure you have the proper database
    63 client software installed.
    64 
    65 === For Mac ===
    66 
    67  * Install Developer Tools
    68  * Install [http://www.macports.org MacPorts]
    69  * Install python25 and libffi via [http://www.macports.org MacPorts]
    70 
    71 
    72 And you should be good to go
    73 
    74        
    75 == Check out Django ==
    76 
    77 Do a subversion checkout of django trunk.
    78 {{{
    79 svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk
    80 }}}
    81 
    82 Django does not need to be modified in order to run on top of PyPy.
    83        
    84 == Python 2.4 ==
    85 
    86 PyPy supports the 2.4 runtime library (although the work is underway to improve the situation),
    87 so you have to be aware of code using 2.5 features.
    88 
    89 Django only requires Python 2.3. So as such Django runs just fine on PyPy.
    90 But, be aware that many popular django applications depend on Python 2.5 runtime lib.
    91 
    92 Getting the Pinax Django Hotclub project running we needed a couple of extra dependencies,
    93  * elementtree
    94  * hashlib
    95 But these have now been included in PyPy during the EuroPython sprint (well done hpk & hruske).
    96 
    97 If you try to run Pinax on cPython 2.4 you would have this dependency problem.
    98 
    99 Also be on the lookout for dependency on PIL, which is not currently ported to ctypes
    100 
    101 == Pinax Project ==
    102 
    103 If you want to get the Pinax project up and running you need to check out the trunk
    104 {{{
    105 svn checkout http://django-hotclub.googlecode.com/svn/trunk/ django-hotclub
    106 }}}
    107 This checks out pinax and all the associated applications from Google Code. If you want to check out with
    108 git follow the instructions on the project wiki at
    109 
    110 http://code.google.com/p/django-hotclub/wiki/UsingGit
    111 
    112 
    113 == Run Django ==
    114 
    115 Switch to the Pinax project directory and run the development server           
    116 {{{
    117 pypy-c ./manage.py syncdb
    118 pypy-c ./manage.py runserver --noreload
    119 }}}
    120 
    121 Reloading doesn't seem to be working properly at the moment, so you need to disable it.
     15Some C-based DB drivers don't work with [[http://pypy.org/ | PyPy]]. See the
     16[[https://bitbucket.org/pypy/compatibility/wiki/Home#!db-adaptors | Compatibility Wiki]] for an overview of what works.
Back to Top