Pylons supports Jython as of v0.9.7.
The installation process is the same as CPython, as described in Getting Started. At least Jython 2.5b2 is required.
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).
First, install snakefight:
$ easy_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:
$ paster make-config MyApp production.ini
$ jython setup.py bdist_war --paste-config production.ini
As with any distutils command the preferred options can instead be added to the setup.cfg in the root directory of the project:
[bdist_war]
paste-config = production.ini
Then we can simply run:
$ jython setup.py bdist_war
bdist_war creates a .war with the following:
With the --paste-config option, it also:
For further information/usages, see snakefight’s documentation.
Powered by Pylons - Contact Administrators
Comments (2)
At the moment, the standard cpython installation instructions aren’t working for me. When I run jython go-pylons.py, it installs setuptools, then errors out with the following:
Traceback (most recent call last):\My Documents\Downloads”): CreateProcess error=193, %1 i
File “go-pylons.py”, line 1505, in
main()
File “go-pylons.py”, line 533, in main
after_install(options, home_dir)
File “go-pylons.py”, line 1145, in after_install
subprocess.call([join(bin_dir, ‘easy_install’),
File “C:\jython2.5.1\Lib\subprocess.py”, line 456, in call
return Popen(*popenargs, **kwargs).wait()
File “C:\jython2.5.1\Lib\subprocess.py”, line 755, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “C:\jython2.5.1\Lib\subprocess.py”, line 1269, in _execute_child
raise OSError(e.getMessage() or e)
OSError: Cannot run program “c:\jylons\bin\easy_install” (in directory “C:\Docum
ents and Settings\
s not a valid Win32 application
As far as I can tell, the easy_install it references is just a python file, so it makes sense that it would complain about this.
Using easy_install for pylons and dependencies appears to have worked, and I was able to create a new project. Unfortunately, when I try to serve it, beaker is giving me an error:
File “C:\p4\otasl.4\massloaderweb\massloaderweb\config\middleware.py”, line 2,
in
from beaker.middleware import SessionMiddleware
File “C:\jython2.5.1\Lib\site-packages\beaker-1.5.3-py2.5.egg\beaker\middlewar
e.py”, line 12, in
from beaker.session import Session, SessionObject
File “C:\jython2.5.1\Lib\site-packages\beaker-1.5.3-py2.5.egg\beaker\session.p
y”, line 7, in
from beaker.crypto import hmac as HMAC, hmac_sha1 as SHA1, md5
File “C:\jython2.5.1\Lib\site-packages\beaker-1.5.3-py2.5.egg\beaker\crypto\__
init__.py”, line 26, in
warn(‘Crypto implementation only supports key lengths up to %d bits. ’
NameError: name ‘warn’ is not defined
Suggest an addition to the docs, or report errors. Note that we will delete documentation fixes as they're applied.
You must login before you can comment.