{ "info": { "author": "Ryan Kelly", "author_email": "ryan@rfk.id.au", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2" ], "description": "m2wsgi: a mongrel2 => wsgi gateway and helper tools\n====================================================\n\n\nThis module provides a WSGI gateway handler for the Mongrel2 webserver,\nallowing easy deployment of python apps on Mongrel2. It provides full support\nfor chunked response encoding, streaming reads of large file uploads, and\npluggable backends for evented I/O a la eventlet.\n\nYou might also find its supporting classes useful for developing non-WSGI\nhandlers in python.\n\n\nCommand-line usage\n------------------\n\nThe simplest way to use this package is as a command-line launcher::\n\n m2wsgi dotted.app.name tcp://127.0.0.1:9999\n\nThis will connect to Mongrel2 on the specified request port and start handling\nrequests by passing them through the specified WSGI app. By default you will\nget a single worker thread handling all requests, which is probably not what\nyou want; increase the number of threads like so::\n\n m2wsgi --num-threads=5 dotted.app.name tcp://127.0.0.1:9999\n\nIf threads aren't your thing, you can just start several instances of the\nhandler pointing at the same zmq socket and get the same effect. Better yet,\nyou can use eventlet to shuffle the bits around like so::\n\n m2wsgi --io=eventlet dotted.app.name tcp://127.0.0.1:9999\n\nYou can also use --io=gevent if that's how you roll. Contributions for\nother async backends are most welcome.\n\n\nProgrammatic Usage\n------------------\n\nIf you have more complicated needs, you can use m2wsgi from within your\napplication. The main class is 'WSGIHandler' which provides a simple\nserver interface. The equivalent of the above command-line usage is::\n\n from m2wsgi.io.standard import WSGIHandler\n handler = WSGIHandler(my_wsgi_app,\"tcp://127.0.0.1:9999\")\n handler.serve()\n\nThere are a lot of \"sensible defaults\" being filled in here. It assumes\nthat the Mongrel2 recv socket is on the next port down from the send socket,\nand that it's OK to connect the socket without a persistent identity.\n\nFor finer control over the connection between your handler and Mongrel2,\ncreate your own Connection object. Here we use 127.0.0.1:9999 as the send\nsocket with identity AA-BB-CC, and use 127.0.0.2:9992 as the recv socket::\n\n from m2wsgi.io.standard import WSGIHandler, Connection\n conn = Connection(send_sock=\"tcp://AA-BB-CC@127.0.0.1:9999\",\n recv_sock=\"tcp://127.0.0.1:9992\")\n handler = WSGIHandler(my_wsgi_app,conn)\n handler.serve()\n\nIf you're creating non-WSGI handlers for Mongrel2 you might find the following\nclasses useful:\n\n :Connection: represents the connection from your handler to Mongrel2,\n through which you can read requests and send responses.\n\n :Client: represents a client connected to the server, to whom you\n can send data at any time.\n\n :Request: represents a client request to which you can asynchronously\n send response data at any time.\n\n :Handler: a base class for implementing handlers, with nothing\n WSGI-specific in it.\n\n\nMiddleware\n----------\n\nIf you need to add fancy features to the server, you can specify additional\nWSGI middleware that should be applied around the application. For example,\nm2wsgi provides a gzip-encoding middleware that can be used to compress\nresponse data::\n\n m2wsgi --middleware=GZipMiddleware\n dotted.app.name tcp://127.0.0.1:9999\n\nIf you want additional compression at the expense of WSGI compliance, you\ncan also do some in-server buffering before the gzipping is applied::\n\n m2wsgi --middleware=GZipMiddleware\n --middleware=BufferMiddleware\n dotted.app.name tcp://127.0.0.1:9999\n\nThe default module for loading middleware is m2wsgi.middleware; specify a\nfull dotted name to load a middleware class from another module.\n\n\nDevices\n-------\n\nThis module also provides a number of pre-built \"devices\" - stand-alone\nexecutables designed to perform a specific common task. Currently availble\ndevices are:\n\n :dispatcher: implements a more flexible request-routing scheme than\n the standard mongrel2 PUSH socket.\n\n :response: implements a simple canned response, with ability to\n interpolate variables from the request.\n\n\n\nDon't we already have one of these?\n-----------------------------------\n\nYes, there are several existing WSGI gateways for Mongrel2:\n\n * https://github.com/berry/Mongrel2-WSGI-Handler\n * https://bitbucket.org/dholth/mongrel2_wsgi\n\nNone of them fully met my needs. In particular, this package has transparent\nsupport for:\n\n * chunked response encoding\n * streaming reads of large \"async upload\" requests\n * pluggable IO backends (e.g. eventlet, gevent)\n\nIt's also designed from the ground up specifically for Mongrel2. This means\nit gets a lot of functionality for free, and the code is simpler and lighter\nas a result.\n\nFor example, there is no explicit management of a threadpool and request queue\nas you might find in e.g. the CherryPy server. Instead, you just start up\nas many threads as you need, have them all connect to the same handler socket,\nand mongrel2 (via zmq) will automatically load-balance the requests to them.\n\nSimilarly, there's no fancy arrangement of master/worker processes to support\nclean reloading of the handler; you just kill the old handler process and start\nup a new one. Send m2wsgi a SIGHUP and it will automatically shutdown and\nreincarnate itself for a clean restart.\n\n\nCurrent bugs, limitations and things to do\n------------------------------------------\n\nIt's not all perfect just yet, although it does seem to mostly work:\n\n * Needs tests something fierce! I just have to find the patience to\n write the necessary setup and teardown cruft.\n\n * It would be great to grab connection details straight from the\n mongrel2 config database. Perhaps a Connection.from_config method\n with keywords to select the connection by handler id, host, route etc.\n\n * support for expect-100-continue; this may have to live in mongrel2", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/rfk/m2wsgi/", "keywords": "wsgi mongrel2", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "m2wsgi", "package_url": "https://pypi.org/project/m2wsgi/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/m2wsgi/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/rfk/m2wsgi/" }, "release_url": "https://pypi.org/project/m2wsgi/0.5.2/", "requires_dist": null, "requires_python": null, "summary": "a mongrel2 => wsgi gateway and helper tools", "version": "0.5.2" }, "last_serial": 794432, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "fca6f93b91c8903698099adb1a2be2c6", "sha256": "2ddd3a9406a373160ad133404e3ccdd03a635834d990ca4ea3a832b9b6b9ecf6" }, "downloads": -1, "filename": "m2wsgi-0.1.0.tar.gz", "has_sig": false, "md5_digest": "fca6f93b91c8903698099adb1a2be2c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10747, "upload_time": "2011-01-26T07:47:14", "url": "https://files.pythonhosted.org/packages/aa/4b/daa1fa3c645d1b6b7a109ac9e043fd3eba7e50aea4b535b2b75724fada9c/m2wsgi-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f57790099a16fa93ffeac90c4ba1b6fc", "sha256": "0d9227bcd8559bf02a8b6f692d56a3c741d72722419042dc67fb0f7315316f4b" }, "downloads": -1, "filename": "m2wsgi-0.1.1.tar.gz", "has_sig": false, "md5_digest": "f57790099a16fa93ffeac90c4ba1b6fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13311, "upload_time": "2011-01-26T14:30:29", "url": "https://files.pythonhosted.org/packages/04/05/301c8f49ed43f38aa431e749dc80425c053547accce163b1ea7bab0ca72b/m2wsgi-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "7f371725c6e7baa37397fbefa4e57a21", "sha256": "973a17aea418cb338b9dc1b82a65ce4465c6a088a2f70b96fb7ecb14a42836a7" }, "downloads": -1, "filename": "m2wsgi-0.2.0.tar.gz", "has_sig": false, "md5_digest": "7f371725c6e7baa37397fbefa4e57a21", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17614, "upload_time": "2011-01-27T01:50:09", "url": "https://files.pythonhosted.org/packages/f3/08/b7d046581d6d715dd4b3930cb1533a3d62a3e5e95f034282ce613afea9ea/m2wsgi-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "2380888ac33f9d067b3be057348196d5", "sha256": "769cd43b85b36c1d46b14bcb2f34635f4cdb029c876e2e1231b0db519f9d64db" }, "downloads": -1, "filename": "m2wsgi-0.3.0.tar.gz", "has_sig": false, "md5_digest": "2380888ac33f9d067b3be057348196d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17983, "upload_time": "2011-01-28T00:22:19", "url": "https://files.pythonhosted.org/packages/34/07/004cd3d0b72a7d70ad2acd89742a19843c804063adf5a438747be0f396cb/m2wsgi-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "3d7ac9e7f9eb9ef4c932bfa756f4d082", "sha256": "0fe89964ffa5b1e3688ae8e54e53306e2af6c9d26775142547de23939813ce86" }, "downloads": -1, "filename": "m2wsgi-0.4.0.tar.gz", "has_sig": false, "md5_digest": "3d7ac9e7f9eb9ef4c932bfa756f4d082", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 41503, "upload_time": "2011-03-04T02:14:14", "url": "https://files.pythonhosted.org/packages/8a/9f/e5f314203722011655834bcd8d4a0c45b0437d65ccfd90a3a7dda3120656/m2wsgi-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "740467d632e6c35f3057747adaa6abc0", "sha256": "f0aa96573973dc64e96315db20076b3bce37a4fb9cc4b32bd2e5ca1e7a16a50c" }, "downloads": -1, "filename": "m2wsgi-0.4.1.tar.gz", "has_sig": false, "md5_digest": "740467d632e6c35f3057747adaa6abc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 42319, "upload_time": "2011-04-15T04:44:01", "url": "https://files.pythonhosted.org/packages/b3/0b/7331405e05d8d17904b7d2d5c0bb2cf9008dceaa34f2c7cff6a356bd9129/m2wsgi-0.4.1.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "9bea2aecdb197e9a48af6c6dd17eddcc", "sha256": "f7d50e0bdf6cbb33eeec9c81c13ffe342250d2f66d0c5ecb0ef9b95472264766" }, "downloads": -1, "filename": "m2wsgi-0.5.1.tar.gz", "has_sig": false, "md5_digest": "9bea2aecdb197e9a48af6c6dd17eddcc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38542, "upload_time": "2012-01-29T23:53:40", "url": "https://files.pythonhosted.org/packages/13/b7/15934304e777761634c80bdf08b8229df76dd96312558fa203b2bb821988/m2wsgi-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "3a3bc0b3466ec2457b49c4a21c4b883f", "sha256": "2d183fe199fac8d788e78ce9d9438374381502f6a7d1f08a7754b59cb8bad172" }, "downloads": -1, "filename": "m2wsgi-0.5.2.tar.gz", "has_sig": false, "md5_digest": "3a3bc0b3466ec2457b49c4a21c4b883f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 40755, "upload_time": "2012-11-27T06:11:23", "url": "https://files.pythonhosted.org/packages/1b/78/cc30012caebe7e6015478d64cbcb3ed4847dc61398ae99a9070a446fc17c/m2wsgi-0.5.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3a3bc0b3466ec2457b49c4a21c4b883f", "sha256": "2d183fe199fac8d788e78ce9d9438374381502f6a7d1f08a7754b59cb8bad172" }, "downloads": -1, "filename": "m2wsgi-0.5.2.tar.gz", "has_sig": false, "md5_digest": "3a3bc0b3466ec2457b49c4a21c4b883f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 40755, "upload_time": "2012-11-27T06:11:23", "url": "https://files.pythonhosted.org/packages/1b/78/cc30012caebe7e6015478d64cbcb3ed4847dc61398ae99a9070a446fc17c/m2wsgi-0.5.2.tar.gz" } ] }