3
========================
4
Running Django on Jython
5
========================
7
.. index:: Jython, Java, JVM
9
Jython_ is an implementation of Python that runs on the Java platform (JVM).
10
Django runs cleanly on Jython version 2.5 or later, which means you can deploy
11
Django on any Java platform.
13
This document will get you up and running with Django on top of Jython.
15
.. _jython: http://jython.org/
20
Django works with Jython versions 2.5 and higher.
24
As of the writing of this document, a version of Jython compatible with
25
Django has not yet been released. The forthcoming 2.5a2+ release will be be
26
the first in which Django will work out of the box.
28
In the meantime, you'll need to use the latest development version of Jython
29
obtained from Jython's SVN repository.
31
Download Jython at http://jython.org/.
33
Creating a servlet container
34
============================
36
If you just want to experiment with Django, skip ahead to the next section;
37
Django includes a lightweight Web server you can use for testing, so you won't
38
need to set up anything else until you're ready to deploy Django in production.
40
If you want to use Django on a production site, use a Java servlet container,
41
such as `Apache Tomcat`_. Full JavaEE applications servers such as `GlassFish`_
42
or `JBoss`_ are also OK, if you need the extra features they include.
44
.. _`Apache Tomcat`: http://tomcat.apache.org/
45
.. _GlassFish: https://glassfish.dev.java.net/
46
.. _JBoss: http://www.jboss.org/
51
The next step is to install Django itself. This is exactly the same as
52
installing Django on standard Python, so see
53
:ref:`removing-old-versions-of-django` and :ref:`install-django-code` for
56
Installing Jython platform support libraries
57
============================================
59
The `django-jython`_ project contains database backends and management commands
60
for Django/Jython development. Note that the builtin Django backends won't work
63
.. _`django-jython`: http://code.google.com/p/django-jython/
65
To install it, follow the `installation instructions`_ detailed on the project
66
website. Also, read the `database backends`_ documentation there.
68
.. _`installation instructions`: http://code.google.com/p/django-jython/wiki/Install
69
.. _`database backends`: http://code.google.com/p/django-jython/wiki/DatabaseBackends
71
Differences with Django on Jython
72
=================================
76
At this point, Django on Jython should behave nearly identically to Django
77
running on standard Python. However, are a few differences to keep in mind:
79
* Remember to use the ``jython`` command instead of ``python``. The
80
documentation uses ``python`` for consistancy, but if you're using Jython
81
you'll want to mentally replace ``python`` with ``jython`` every time it
84
* Similarly, you'll need to use the ``JYTHONPATH`` environment variable
85
instead of ``PYTHONPATH``.