Skip to main content

Middleware and support tools for use Storm ORM in WSGI applications

Project description

Package enable to use Storm ORM as DB interface in WSGI applications. Also gives tools for efficient models unit-testing.

Contains:

MiddleStorm - WSGI middleware. Add thread safe Store object into environ dictonary.

middlestorm - WSGI middleware decorator.

SingleConn - Storm Database object proxy. Make single database connection. Useful for “readonly” applications.

ModelTestCase - A base class for modes unit-testing. Give easy way for “fixture” definition.

Typical Use-Case (WSGI)

from wsgiref.simple_server import make_server

from middlestorm import MiddleStorm
from storm.database import create_database

def storm_app(environ, start_response):
    # thread safe Store object instance
    store = environ['storm.store']
    # application logic
    ...

#create database
db = create_database('postgres://user:password@host/base')
# create middleware for database access
app = MiddleStorm(storm_app, db)

make_server('', 8000, app).serve_forever()

read more… (unit-testing, fixtures, pylons integration)

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page