Plain Text | 73 lines | 51 code | 22 blank | 0 comment | 0 complexity | 6996cf020041a85dc5e6004f0807a376 MD5 | raw file
1======================== 2Running Django on Jython 3======================== 4 5.. index:: Jython, Java, JVM 6 7Jython_ is an implementation of Python that runs on the Java platform (JVM). 8Django runs cleanly on Jython version 2.5 or later, which means you can deploy 9Django on any Java platform. 10 11This document will get you up and running with Django on top of Jython. 12 13.. _jython: http://www.jython.org/ 14 15Installing Jython 16================= 17 18Django works with Jython versions 2.5b3 and higher. Download Jython at 19http://www.jython.org/. 20 21Creating a servlet container 22============================ 23 24If you just want to experiment with Django, skip ahead to the next section; 25Django includes a lightweight Web server you can use for testing, so you won't 26need to set up anything else until you're ready to deploy Django in production. 27 28If you want to use Django on a production site, use a Java servlet container, 29such as `Apache Tomcat`_. Full JavaEE applications servers such as `GlassFish`_ 30or `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 36Installing Django 37================= 38 39The next step is to install Django itself. This is exactly the same as 40installing Django on standard Python, so see 41:ref:`removing-old-versions-of-django` and :ref:`install-django-code` for 42instructions. 43 44Installing Jython platform support libraries 45============================================ 46 47The `django-jython`_ project contains database backends and management commands 48for Django/Jython development. Note that the builtin Django backends won't work 49on top of Jython. 50 51.. _`django-jython`: http://code.google.com/p/django-jython/ 52 53To install it, follow the `installation instructions`_ detailed on the project 54Web 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 59Differences with Django on Jython 60================================= 61 62.. index:: JYTHONPATH 63 64At this point, Django on Jython should behave nearly identically to Django 65running 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 consistency, 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``.