Skip to content

Latest commit

 

History

History
85 lines (56 loc) · 2.56 KB

jython.rst

File metadata and controls

85 lines (56 loc) · 2.56 KB

Pylons on Jython

Pylons supports Jython as of v0.9.7.

Installation

The installation process is the same as CPython, as described in getting_started. At least Jython 2.5b2 is required.

Deploying to Java Web servers

The Java platform defines the Servlet API for creating web applications. The modjy library included with Jython provides a gateway between Java Servlets and WSGI applications.

The snakefight tool can create a WAR file from a Pylons application (and modjy) that's suitable for deployment to the various Servlet containers (such as Apache Tomcat or Sun's Glassfish).

Creating .wars with snakefight

First, install snakefight:

This adds an additional command to distutils: bdist_war.

Pylons applications are loaded from Paste, via its paste.app_factory entry point and a Paste style configuration file. bdist_war knows how to setup Paste apps for deployment when specified the --paste-config option:

As with any distutils command the preferred options can instead be added to the setup.cfg in the root directory of the project:

Then we can simply run:

bdist_war creates a .war with the following:

  • Jython's jar files in WEB-INF/lib
  • Jython's stdlib in WEB-INF/lib-python
  • Your application's required eggs in WEB-INF/lib-python

With the --paste-config option, it also:

  • Creates a simple loader for the application/config
  • Generates a web.xml deployment descriptor configuring modjy to load the application with the simple loader

For further information/usages, see snakefight's documentation.