CloudServices/ServerSetup
Jump to navigation
Jump to search
Server Framework for Services projects
What's a WSGI application
XXX
Directory Structure
<hg-repo-name>
|
|--MAKEFILE
|--Manifest.in
|--READMEs
|--scripts
|--setup.cfg
|--setup.py
|--<nameofproject>.wsgi
|--<NameOfProject>.spec
|--etc
|--*.conf
|--paste
|--*.ini
|--<nameofproject>
|--init.py
|--[wsgiapp.py]
|--controllers and other code files
|--tests
|--test_*.py
nameofproject.wsgi, wsgiapp.py and WebOb
Python uses WSGI to implement a CGI-like behavior. We wrap this in WebOb
In wsgiapp.py:
from webob.dec import wsgify
In your class within:
@wsgify def __call__(self, request):
request contains the webob request object.
At the end of the file:
def make_app(global_conf, **app_conf): global_conf.update(app_conf) app = AdminDbApp(global_conf) return app
In nameofproject.wsgi:
from nameofproject.wsgiapp import make_app application = make_app(config_dict)
The application in nameofproject.wsgi is the variable being looked for by the wsgi spec. This wraps up a fully-configured object.