jython.txt 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ========================
  2. Running Django on Jython
  3. ========================
  4. .. index:: Jython, Java, JVM
  5. Jython_ is an implementation of Python that runs on the Java platform (JVM).
  6. This document will get you up and running with Django on top of Jython.
  7. Installing Jython
  8. =================
  9. Django works with Jython versions 2.7b2 and higher. See the Jython_ website for
  10. download and installation instructions.
  11. .. _jython: http://www.jython.org/
  12. Creating a servlet container
  13. ============================
  14. If you just want to experiment with Django, skip ahead to the next section;
  15. Django includes a lightweight Web server you can use for testing, so you won't
  16. need to set up anything else until you're ready to deploy Django in production.
  17. If you want to use Django on a production site, use a Java servlet container,
  18. such as `Apache Tomcat`_. Full JavaEE applications servers such as `GlassFish`_
  19. or `JBoss`_ are also OK, if you need the extra features they include.
  20. .. _`Apache Tomcat`: http://tomcat.apache.org/
  21. .. _GlassFish: https://glassfish.java.net/
  22. .. _JBoss: http://www.jboss.org/
  23. Installing Django
  24. =================
  25. The next step is to install Django itself. This is exactly the same as
  26. installing Django on standard Python, so see
  27. :ref:`removing-old-versions-of-django` and :ref:`install-django-code` for
  28. instructions.
  29. Installing Jython platform support libraries
  30. ============================================
  31. The `django-jython`_ project contains database backends and management commands
  32. for Django/Jython development. Note that the builtin Django backends won't work
  33. on top of Jython.
  34. .. _`django-jython`: https://github.com/beachmachine/django-jython
  35. To install it, follow the `installation instructions`_ detailed on the project
  36. website. Also, read the `database backends`_ documentation there.
  37. .. _`installation instructions`: https://pythonhosted.org/django-jython/quickstart.html#install
  38. .. _`database backends`: https://pythonhosted.org/django-jython/database-backends.html
  39. Differences with Django on Jython
  40. =================================
  41. .. index:: JYTHONPATH
  42. At this point, Django on Jython should behave nearly identically to Django
  43. running on standard Python. However, are a few differences to keep in mind:
  44. * Remember to use the ``jython`` command instead of ``python``. The
  45. documentation uses ``python`` for consistency, but if you're using Jython
  46. you'll want to mentally replace ``python`` with ``jython`` every time it
  47. occurs.
  48. * Similarly, you'll need to use the ``JYTHONPATH`` environment variable
  49. instead of ``PYTHONPATH``.
  50. * Any part of Django that requires `Pillow`_ will not work.
  51. .. _Pillow: http://pillow.readthedocs.org/en/latest/