| 1 | import sampleapp |
|---|
| 2 | from paste.deploy.config import ConfigMiddleware |
|---|
| 3 | |
|---|
| 4 | def make_app( |
|---|
| 5 | global_conf, |
|---|
| 6 | # Optional and required configuration parameters |
|---|
| 7 | # can go here, or just **kw; greeting is required: |
|---|
| 8 | greeting, |
|---|
| 9 | **kw): |
|---|
| 10 | # This is a WSGI application: |
|---|
| 11 | app = sampleapp.application |
|---|
| 12 | # Here we merge all the keys into one configuration |
|---|
| 13 | # dictionary; you don't have to do this, but this |
|---|
| 14 | # can be convenient later to add ad hoc configuration: |
|---|
| 15 | conf = global_conf.copy() |
|---|
| 16 | conf.update(kw) |
|---|
| 17 | conf['greeting'] = greeting |
|---|
| 18 | # ConfigMiddleware means that paste.deploy.CONFIG will, |
|---|
| 19 | # during this request (threadsafe) represent the |
|---|
| 20 | # configuration dictionary we set up: |
|---|
| 21 | app = ConfigMiddleware(app, conf) |
|---|
| 22 | return app |
|---|
| 23 | |
|---|