.. _WSGI: http://www.wsgi.org/wsgi/ .. _Jython: http://jython.org/ .. _oss: http://oss.sonatype.org/ .. _Soldat: http://bitbucket.org/sunng/soldat/ .. _Mina: http://mina.apache.org/ .. _Jetty: http://www.eclipse.org/jetty/ .. _Netty: http://www.jboss.org/netty/ ==================== Gefr: WSGI on Jython ==================== .. image:: _static/logo.png Gefr is a suite of adapters enables you to run Python WSGI_ web applications on Jython_ platform. Installation ============ It's always better to install gefr inside a virtual environment:: $ virtualenv -p /usr/local/bin/jython gefr-env $ cd gefr-env $ source bin/activate Install jip to resolve Java dependencies:: $ pip install jip Install gefr with pip:: $ pip install gefr jip will download Java dependencies automatically for you. Then you are ready to use gefr. Quick Start =========== You can run any WSGI application with gefr: :: from gefr.core import Gefr from gefr.backends.jetty import JettyBackend HOST = '' PORT = 8000 def wsgiapp(environ, start_response): status = '200 OK' res_body = "Welcome

It works!

" res_headers = [('Content-Type', 'text/html'), ('Content-Length', str(len(res_body)))] start_response(status, res_headers) return [res_body] Gefr(wsgiapp, JettyBackend, host='', port=8000).start() To run it with libraries included, use ``jython-all`` instead of jython:: $ jython-all example.py Backends ======== Gefr is design to support multiple backends. Currently, the following backends are available to use: * Soldat_ (``gefr.backends.soldat.SoldatBackend``) * Mina_ (``gefr.backends.mina.MinaBackend``) * Jetty_ (``gefr.backends.jetty.JettyBackend``) (Recommend) * Netty_ (``gefr.backends.netty.NettyBackend``) License ======= Currently gefr is available according to the MIT License :: Copyright (c) 2011, Sun Ning. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Links ===== * `Project hosting `_ * `Python cheese shop `_ * `Online documentation `_