Fork me on GitHub

The Web Framework that scales with you.

TurboGears 2 is built on top of the experience of several next generation web frameworks including TurboGears 1 (of course), Django, and Rails. All of these frameworks had limitations that frustrated us, and TG2 was built as an answer to that frustration:

Start Small

TurboGears can start as a single file app through its minimal mode setup:

 from wsgiref.simple_server import make_server
 from tg import MinimalApplicationConfigurator
 from tg import expose, TGController

 # RootController of our web app, in charge of serving content for /
 class RootController(TGController):
     @expose(content_type="text/plain")
     def index(self):
         return 'Hello World'

 # Configure a new minimal application with our root controller.
 config = MinimalApplicationConfigurator()
 config.update_blueprint({
     'root_controller': RootController()
 })

 # Serve the newly configured web application.
 print("Serving on port 8080...")
 httpd = make_server('', 8080, config.make_wsgi_app())
 httpd.serve_forever()

which you can then run on Python itself:

$ pip install TurboGears2
$ python myapp.py

Or Scale to a FullStack Solution

TurboGears can scale to a full stack solution for more complex applications using TurboGears devtools:

$ pip install tg.devtools
$ gearbox quickstart myproj

The newly created myproj application can be started with the Gearbox toolchain:

$ cd myproj
$ pip install -e .
$ gearbox serve

Feature Complete and Flexible

or follow TurboGears on Twitter for the latest news!

Give It a Try

TurboGears 2 works on Python 2.7, 3.4, 3.5, 3.6, 3.7 and 3.8.

Or set it up in a virtual environment on your machine:

$ virtualenv --no-site-packages tg2env
$ cd tg2env/
$ source bin/activate
(tg2env)$ pip install tg.devtools

(tg2env)$ gearbox quickstart example
(tg2env)$ cd example/
(tg2env)$ pip install -e .
(tg2env)$ gearbox serve

Get started Learning TurboGears 2 by looking at Documentation and our famous wiki tutorial.