{"title":"Running Django on Jython","version":"1.9","locale":"en","docname":"howto/jython","url":"/en/1.9/howto/jython/","canonical":"https://djangodocs.dev/en/1.9/howto/jython/","summary":"Jython is an implementation of Python that runs on the Java platform (JVM). This document will get you up and running with Django on top of Jython. Installing…","html":"<h1>Running Django on Jython<a class=\"heading-anchor\" href=\"#running-django-on-jython\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p id=\"index-0\"><a class=\"reference external\" href=\"http://www.jython.org/\">Jython</a> is an implementation of Python that runs on the Java platform (JVM).\nThis document will get you up and running with Django on top of Jython.</p>\n<section id=\"installing-jython\">\n<h2>Installing Jython<a class=\"heading-anchor\" href=\"#installing-jython\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django works with Jython versions 2.7b2 and higher. See the <a class=\"reference external\" href=\"http://www.jython.org/\">Jython</a> website for\ndownload and installation instructions.</p>\n</section>\n<section id=\"creating-a-servlet-container\">\n<h2>Creating a servlet container<a class=\"heading-anchor\" href=\"#creating-a-servlet-container\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>If you just want to experiment with Django, skip ahead to the next section;\nDjango includes a lightweight Web server you can use for testing, so you won’t\nneed to set up anything else until you’re ready to deploy Django in production.</p>\n<p>If you want to use Django on a production site, use a Java servlet container,\nsuch as <a class=\"reference external\" href=\"https://tomcat.apache.org/\">Apache Tomcat</a>. Full JavaEE applications servers such as <a class=\"reference external\" href=\"https://glassfish.java.net/\">GlassFish</a>\nor <a class=\"reference external\" href=\"https://www.jboss.org/\">JBoss</a> are also OK, if you need the extra features they include.</p>\n</section>\n<section id=\"installing-django\">\n<h2>Installing Django<a class=\"heading-anchor\" href=\"#installing-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>The next step is to install Django itself. This is exactly the same as\ninstalling Django on standard Python, so see\n<a class=\"reference internal\" href=\"/en/1.9/topics/install/#removing-old-versions-of-django\"><span class=\"std std-ref\">Remove any old versions of Django</span></a> and <a class=\"reference internal\" href=\"/en/1.9/topics/install/#install-django-code\"><span class=\"std std-ref\">Install the Django code</span></a> for\ninstructions.</p>\n</section>\n<section id=\"installing-jython-platform-support-libraries\">\n<h2>Installing Jython platform support libraries<a class=\"heading-anchor\" href=\"#installing-jython-platform-support-libraries\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>The <a class=\"reference external\" href=\"https://github.com/beachmachine/django-jython\">django-jython</a> project contains database backends and management commands\nfor Django/Jython development. Note that the builtin Django backends won’t work\non top of Jython.</p>\n<p>To install it, follow the <a class=\"reference external\" href=\"https://pythonhosted.org/django-jython/quickstart.html#install\">installation instructions</a> detailed on the project\nwebsite. Also, read the <a class=\"reference external\" href=\"https://pythonhosted.org/django-jython/database-backends.html\">database backends</a> documentation there.</p>\n</section>\n<section id=\"differences-with-django-on-jython\">\n<h2>Differences with Django on Jython<a class=\"heading-anchor\" href=\"#differences-with-django-on-jython\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p id=\"index-1\">At this point, Django on Jython should behave nearly identically to Django\nrunning on standard Python. However, are a few differences to keep in mind:</p>\n<ul class=\"simple\">\n<li><p>Remember to use the <code class=\"docutils literal notranslate\"><span class=\"pre\">jython</span></code> command instead of <code class=\"docutils literal notranslate\"><span class=\"pre\">python</span></code>. The\ndocumentation uses <code class=\"docutils literal notranslate\"><span class=\"pre\">python</span></code> for consistency, but if you’re using Jython\nyou’ll want to mentally replace <code class=\"docutils literal notranslate\"><span class=\"pre\">python</span></code> with <code class=\"docutils literal notranslate\"><span class=\"pre\">jython</span></code> every time it\noccurs.</p></li>\n<li><p>Similarly, you’ll need to use the <code class=\"docutils literal notranslate\"><span class=\"pre\">JYTHONPATH</span></code> environment variable\ninstead of <code class=\"docutils literal notranslate\"><span class=\"pre\">PYTHONPATH</span></code>.</p></li>\n<li><p>Any part of Django that requires <a class=\"reference external\" href=\"https://pillow.readthedocs.io/en/latest/\">Pillow</a> will not work.</p></li>\n</ul>\n</section>","rootId":"running-django-on-jython","toc":[{"title":"Installing Jython","anchor":"installing-jython","children":[]},{"title":"Creating a servlet container","anchor":"creating-a-servlet-container","children":[]},{"title":"Installing Django","anchor":"installing-django","children":[]},{"title":"Installing Jython platform support libraries","anchor":"installing-jython-platform-support-libraries","children":[]},{"title":"Differences with Django on Jython","anchor":"differences-with-django-on-jython","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"“How-to” guides","url":"/en/1.9/howto/"}],"prev":{"docname":"howto/initial-data","title":"Providing initial data for models","url":"/en/1.9/howto/initial-data/"},"next":{"docname":"howto/legacy-databases","title":"Integrating Django with a legacy database","url":"/en/1.9/howto/legacy-databases/"},"formats":{"html":"/en/1.9/howto/jython/","markdown":"/en/1.9/howto/jython.md","json":"/en/1.9/howto/jython.json"},"source":"https://github.com/django/django/blob/stable/1.9.x/docs/howto/jython.txt","official":"https://docs.djangoproject.com/en/1.9/howto/jython/","inVersions":["2.2","2.1","2.0","1.11","1.10","1.9","1.8"],"inLocales":["en","fr","ja","id","pt-br","es"]}