jython.txt 2.8 KB

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