Speed up development with full-stack environments for every branch.

Learn More

Automatic Breadcrumbs with TurboGears [Python]

Forked from Request Method Dispatch in TurboGears.

109 Runs 114 Views 64 Copies


amol 16

published 3 years ago

from wsgiref.simple_server import make_server
from tg import expose, TGController, RestController, AppConfig, request

class SubSubSectionController(TGController):
  TITLE = 'Sub Sub Section'
  def index(self, **kw):
    return dict(page=self.TITLE)

class SubSectionController(RestController):
  TITLE = 'Sub Section'
  sub = SubSubSectionController()
  def index(self, **kw):
    return dict(page=self.TITLE)

class RootController(TGController):
  TITLE = 'Root'
  sub = SubSectionController()

  def index(self):
    return dict(page=self.TITLE) 

config = AppConfig(minimal=True, root_controller=RootController())
config.renderers = ['genshi']

httpd = make_server('', 80, config.make_wsgi_app(**DEPLOY_OPTIONS))

print "Serving on port 80..."
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).