This is an attempt to discover a canonical answer for something that seems to be hard to Google for right now. I am writing a web app in Pyramid, and I have the luxury of deciding what my server stack will look like. I've heard very good things about Mongrel2, and would like to try using it to serve my app. However, I can't figure out from the Mongrel2 manual and Google searches, how to connect Mongrel2 to a WSGI app. Do I have to roll my own, or are there existing solutions to this problem?
In pursuit of a canonical answer, here are the WSGI handlers that I've found while looking for a way to get Mongrel2 to serve a WSGI app. Right now, it looks like wsgid is the best bet for Django users, but terminally flawed for others, and the alternatives are flawed.
- The wsgid project is not yet at 1.0, but there are a lot of things that are usable before 1.0. It seems to have an active community around it, which is a recommendation.
- The m2wsgi handler appears to mostly be one guy's project, but it looks to be alive, and "I started writing foo because I tried bar and baz and they didn't quite solve my problem" is a good place to start, and its feature-list looks good.
- The Mongrel2-WSGI-Handler project on GitHub hasn't had a commit in over a year, so while it might be functional, I'm a little wary of it.
- The mongrel2_wsgi project on BitBucket also hasn't had a commit in over a year, so it doesn't look like a great candidate either.
- Brubeck is an entire web framework built on Mongrel2 and Python, which looks interesting.
Discussions and posts elsewhere about this topic:
- LibreList: "State of WSGI handlers?"
- Hacker News: "Brubeck: a new Python web framework running on Mongrel2"
- Shedding Bikes: "Mongrel2 Python Library Working"
- Spike Labs: "Deploying graphite on Mongrel2"
- Dalton Matos: "Deploying Your Django Application With Mongrel2 and wsgid"
There is this post I wrote that talks about how to setup a mongrel2 with wsgid to run your WSGI app. It's here: http://daltonmatos.wordpress.com/2011/11/06/deploying-your-django-application-with-mongrel2-and-wsgid/
You need to use a Mongrel 2 handler that can serve a WSGI application. Basically something that translates the messages from a mongrel2 zeromq socket into a wsgi environ. There are several of these, I've used m2wsgi successfully in the past, but I think wsgid looks very promising as well.
Specifically about wsgid, you will probably need to tell it to load a generic WSGI application. You can know more about how to do it in the docs: Loading a generic WSGI Application, but implementing an AppLoader would not be that difficult.
If you need any other help you can send an email to the mailing list, will be a pleasure to help.
© 2022 - 2024 — McMap. All rights reserved.