Ticket #4947 enhancement closed wontfix
Routes dispatching in twisted.web.server
| Reported by: | steiza | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | web | Keywords: | |
| Cc: | jknight | Branch: | |
| Author: | Launchpad Bug: |
Description (last modified by tom.prince) (diff)
It would be nice to have an option to use Routes-based dispatching in twisted.web.server.
Something like:
from twisted.web.server import Site class Controller(object): def index(self, request): return '<html><body>Hello World!</body></html>' c = Controller() dispatcher = Dispatcher() dispatcher.connect(name='index', route='/', controller=c, action='index') factory = Site(dispatcher)
You would then also be able to do stuff like this:
from twisted.web.static import File dispatcher.putChild('static', File(static_path))
We could adapt something like https://github.com/steiza/twistedroutes; we're using this for several internal webservices at work and it's quite nice to program in. : )
Change History
Note: See
TracTickets for help on using
tickets.
