Skip to main content

Run WSGI applications with PasteDeploy and gevent.

Project description

With pastegevent package you can run your WSGI applications on top of gevent’s high performace HTTP server.

Configuration

Just use egg:pastegevent#gevent as use directive value of your server configuration section:

[server:main]
use = egg:pastegevent#gevent

If you need to pastegevent to monkey patch stdlib modules for you, use egg:pastegevent#gevent_patched. This will monkey patch all, except DNS subsystem:

[server:main]
use = egg:pastegevent#gevent_patched

But no DNS patching is performed due to inability to reinitialize libevent’s DNS subsystem after forking.

Using of asynchronous DNS resolving with evdns

If your application relies heavy on asyncronous DNS resolving, you probably still need to patch stdlib to use evdns to resolve domain names. Fortunately there are few steps to workaround issue with evdns initialization.

First thing to do is to be sure not not make any network interactions before server startup, so libevent (and its DNS subsystem in particular) will be not be initialized before daemonization. That means no network code in WSGI application factory.

Then you should configure server to use non-patched version of gevent server factory:

[server:main]
use = egg:pastegevent#gevent

and patch DNS yourself in application factory:

def app(global_config, **settings):
    from gevent.monkey import patch_all
    patch_all()
    return wsgi_app

Now your application can take the advantages of asyncronous DNS resolving.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pastegevent, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size pastegevent-0.1-py2.6.egg (3.0 kB) File type Egg Python version 2.6 Upload date Hashes View
Filename, size pastegevent-0.1.tar.gz (1.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page