|
1 ======================== |
|
2 Running Django on Jython |
|
3 ======================== |
|
4 |
|
5 .. index:: Jython, Java, JVM |
|
6 |
|
7 Jython_ is an implementation of Python that runs on the Java platform (JVM). |
|
8 Django runs cleanly on Jython version 2.5 or later, which means you can deploy |
|
9 Django on any Java platform. |
|
10 |
|
11 This document will get you up and running with Django on top of Jython. |
|
12 |
|
13 .. _jython: http://www.jython.org/ |
|
14 |
|
15 Installing Jython |
|
16 ================= |
|
17 |
|
18 Django works with Jython versions 2.5b3 and higher. Download Jython at |
|
19 http://www.jython.org/. |
|
20 |
|
21 Creating a servlet container |
|
22 ============================ |
|
23 |
|
24 If you just want to experiment with Django, skip ahead to the next section; |
|
25 Django includes a lightweight Web server you can use for testing, so you won't |
|
26 need to set up anything else until you're ready to deploy Django in production. |
|
27 |
|
28 If you want to use Django on a production site, use a Java servlet container, |
|
29 such as `Apache Tomcat`_. Full JavaEE applications servers such as `GlassFish`_ |
|
30 or `JBoss`_ are also OK, if you need the extra features they include. |
|
31 |
|
32 .. _`Apache Tomcat`: http://tomcat.apache.org/ |
|
33 .. _GlassFish: https://glassfish.dev.java.net/ |
|
34 .. _JBoss: http://www.jboss.org/ |
|
35 |
|
36 Installing Django |
|
37 ================= |
|
38 |
|
39 The next step is to install Django itself. This is exactly the same as |
|
40 installing Django on standard Python, so see |
|
41 :ref:`removing-old-versions-of-django` and :ref:`install-django-code` for |
|
42 instructions. |
|
43 |
|
44 Installing Jython platform support libraries |
|
45 ============================================ |
|
46 |
|
47 The `django-jython`_ project contains database backends and management commands |
|
48 for Django/Jython development. Note that the builtin Django backends won't work |
|
49 on top of Jython. |
|
50 |
|
51 .. _`django-jython`: http://code.google.com/p/django-jython/ |
|
52 |
|
53 To install it, follow the `installation instructions`_ detailed on the project |
|
54 Web site. Also, read the `database backends`_ documentation there. |
|
55 |
|
56 .. _`installation instructions`: http://code.google.com/p/django-jython/wiki/Install |
|
57 .. _`database backends`: http://code.google.com/p/django-jython/wiki/DatabaseBackends |
|
58 |
|
59 Differences with Django on Jython |
|
60 ================================= |
|
61 |
|
62 .. index:: JYTHONPATH |
|
63 |
|
64 At this point, Django on Jython should behave nearly identically to Django |
|
65 running on standard Python. However, are a few differences to keep in mind: |
|
66 |
|
67 * Remember to use the ``jython`` command instead of ``python``. The |
|
68 documentation uses ``python`` for consistancy, but if you're using Jython |
|
69 you'll want to mentally replace ``python`` with ``jython`` every time it |
|
70 occurs. |
|
71 |
|
72 * Similarly, you'll need to use the ``JYTHONPATH`` environment variable |
|
73 instead of ``PYTHONPATH``. |