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
Saved

Saved

amol 16

amol
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'
  
  @expose('index.html')
  def index(self, **kw):
    return dict(page=self.TITLE)


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


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

  @expose('index.html')
  def index(self):
    return dict(page=self.TITLE) 



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

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

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

Your session has timed out.

Dismiss (the page may not function properly).