What's new? | Help | Directory | Sign in
Google
modwsgi
Python WSGI adapter module for Apache.
  
  
  
  
    
License: Apache License 2.0
Labels: Python, Apache, WSGI
Show all Featured Downloads:
mod_wsgi-2.0.tar.gz
Join project
Project owners:
  Graham.Dumpleton

What Is mod_wsgi?

Although solutions exist for hosting Python web applications using Apache, they are either slow, complicated to use, unreliable, or not suitable for commodity web hosting.

The aim of mod_wsgi is to implement a simple to use Apache module which can host any Python application which supports the Python WSGI interface. The module would be suitable for use in hosting high performance production web sites, as well as your average personal sites running on commodity web hosting services.

With a bit more work and encouragement, future versions of mod_wsgi will include additional features which should help it to also break into the truly low cost commodity web hosting market where Python is currently sadly lacking as an option.

Modes Of Operation

When hosting WSGI applications using mod_wsgi, one of two primary modes of operation can be used. In 'embedded' mode, mod_wsgi works in a similar way to mod_python in that the Python application code will be executed within the context of the normal Apache child processes. WSGI applications when run in this mode will therefore share the same processes as other Apache hosted applications using Apache modules for PHP and Perl. This mode does however yield the best performance and would be recommended for sites with high performance requirements.

An alternate mode of operation is 'daemon' mode. This mode operates in similar ways to FASTCGI/SCGI solutions, whereby distinct processes can be dedicated to run a WSGI application. Unlike FASTCGI/SCGI solutions however, a separate infrastructure is not needed when implementing the WSGI application and everything is handled automatically by mod_wsgi.

Because the WSGI applications in daemon mode are being run in their own processes, the impact on the normal Apache child processes used to serve up static files and host applications using Apache modules for PHP, Perl or some other language is minimal. Daemon processes may if required also be run as a distinct user ensuring that WSGI applications cannot interfere with each other or access information they shouldn't be able to. It would generally be recommended that except where a site truly has high performance requirements that this mode always be used.

Server Performance

The mod_wsgi module is written in C code directly against the internal Apache and Python application programming interfaces. As such, for hosting WSGI applications in conjunction with Apache it has a lower memory overhead and performs better than existing WSGI adapters for mod_python or alternative FASTCGI/SCGI/CGI or proxy based solutions.

Supported Applications

As mod_wsgi supports the WSGI interface specification, any Python web framework or application which is compatible with the WSGI interface specification should be able to be hosted on top of mod_wsgi.

Major Python web frameworks which are known to work include CherryPy, Django, Karrigell, Pylons, TurboGears, web.py and Zope. Major Python web applications which are known to work include MoinMoin, PyBlosxom and Trac.

System Requirements

The mod_wsgi package can be compiled for and used with either Apache 1.3, 2.0 or 2.2 on UNIX systems (including Linux), as well as Windows. Either the single threaded 'prefork' or multithreaded 'worker' Apache MPMs can be used when running on UNIX.

Daemon mode of mod_wsgi will however only be available on Apache 2.0 or 2.2 running on UNIX, and only when the Apache runtime library underlying Apache has been compiled with support for threading.

Python 2.3 or later is required and Python must have been compiled with support for threading.

Getting Started

The most up to date and recommended version of mod_wsgi is 2.0.

Ensure that you first read the documentation covering installation and configuration. Additional guidelines are also provided for developers working with applications on top of mod_wsgi so as to get the most out of mod_wsgi, but also to assist in debugging problems or issues that arise with your application.

If you don't understand a problem you are having with your application, or believe you have found a problem with mod_wsgi, raise the issue on the mod_wsgi user group.

Contributing

Developing software as Open Source is more often than not a thankless task. If you would like to show your appreciation for the fact that this software has been made available and it has been helpful to you, then as a way of giving back consider posting to the user group describing any successes or problems you have had with the software. It is only through your feedback that one can ever know if the software is working correctly and how the software and/or documentation may have to be improved to better meet your needs. If that sounds like too much hard work, at least consider helping to push up my kudos ranking on Ohloh.

Also please note that contrary to what is being reported in some forums, this project is in no way affiliated with Google or funded by Google (or any other company) in any way. The only connection with Google is that the project code is hosted on the free and public Google code hosting service. All development on this project is done at my own cost in personal time. If you find mod_wsgi useful and would like to contribute in a more concrete way, then perhaps check out my Amazon wish list or donate via microPledge.

Enjoy.

Graham Dumpleton