~ubuntu-branches/ubuntu/quantal/python-django/quantal

« back to all changes in this revision

Viewing changes to docs/howto/jython.txt

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant, Eddy Mulyono
  • Date: 2008-09-16 12:18:47 UTC
  • mfrom: (1.1.5 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080916121847-mg225rg5mnsdqzr0
Tags: 1.0-1ubuntu1
* Merge from Debian (LP: #264191), remaining changes:
  - Run test suite on build.

[Eddy Mulyono]
* Update patch to workaround network test case failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.. _howto-jython:
 
2
 
 
3
========================
 
4
Running Django on Jython
 
5
========================
 
6
 
 
7
.. index:: Jython, Java, JVM
 
8
 
 
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.
 
12
 
 
13
This document will get you up and running with Django on top of Jython.
 
14
 
 
15
.. _jython: http://jython.org/
 
16
 
 
17
Installing Jython
 
18
=================
 
19
 
 
20
Django works with Jython versions 2.5 and higher. 
 
21
 
 
22
.. warning::
 
23
 
 
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. 
 
27
    
 
28
    In the meantime, you'll need to use the latest development version of Jython
 
29
    obtained from Jython's SVN repository.
 
30
 
 
31
Download Jython at http://jython.org/.
 
32
 
 
33
Creating a servlet container
 
34
============================
 
35
 
 
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.
 
39
 
 
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.
 
43
 
 
44
.. _`Apache Tomcat`: http://tomcat.apache.org/
 
45
.. _GlassFish: https://glassfish.dev.java.net/
 
46
.. _JBoss: http://www.jboss.org/
 
47
 
 
48
Installing Django
 
49
=================
 
50
 
 
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
 
54
instructions.
 
55
 
 
56
Installing Jython platform support libraries
 
57
============================================
 
58
 
 
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
 
61
on top of Jython.
 
62
 
 
63
.. _`django-jython`: http://code.google.com/p/django-jython/
 
64
 
 
65
To install it, follow the `installation instructions`_ detailed on the project
 
66
website. Also, read the `database backends`_ documentation there.
 
67
 
 
68
.. _`installation instructions`: http://code.google.com/p/django-jython/wiki/Install
 
69
.. _`database backends`: http://code.google.com/p/django-jython/wiki/DatabaseBackends
 
70
 
 
71
Differences with Django on Jython
 
72
=================================
 
73
 
 
74
.. index:: JYTHONPATH
 
75
 
 
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:
 
78
 
 
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
 
82
      occurs.
 
83
     
 
84
    * Similarly, you'll need to use the ``JYTHONPATH`` environment variable
 
85
      instead of ``PYTHONPATH``.