We’ve already seen how we can do this in the Configure Rum to create an interface for your model section of the tutorial.
The basic steps are:
PasteDeploy can be used to do this easily since Rum implements a paste.app_factory entry point. A sample paste deploy configuration file:
[DEFAULT]
debug = true
[server:main]
use = egg:Paste#http
host = 127.0.0.1
port = 5000
[app:main]
use = egg:rum
full_stack = True
config = %(here)s/development.cfg
The development.cfg file it refers to, which configures rum.RumApp in the same way as a config dictionary would, is this one:
[DEFAULT]
debug = True
[rum.repositoryfactory]
use = 'sqlalchemy'
# These will be imported. Notation is package.subpackage.module:class
models = ['model:Person', 'model:Genre', 'model:Actor', 'model:Director', 'model:Movie', 'model:Rental']
sqlalchemy.url = 'sqlite:///movie.db'
session.transactional = True
[rum.viewfactory]
use = 'toscawidgets'
Notice that the configuration passed in this file mirrors the one we used in the Configure Rum to create an interface for your model section of the tutorial.
Rum applications are self-contained, they store no state outside the graph of objects reachable from rum.RumApp so several Rum applications can coexist in the same process each of them configured in a different way.
One of the things this design enables is to run Rum inside another framework that suports delegating the response process from a controller to another WSGI app. AFAIK, Pylons (and by extension, TurboGears 2) is the only popular Python web-framework that supports this.
Why would we want to do this?
TODO: Write this
TODO: Write this