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:
TurboGears can start as a single file app through its minimal mode setup:
from wsgiref.simple_server import make_server
from tg import expose, TGController, AppConfig
class RootController(TGController):
@expose()
def index(self):
return "<h1>Hello World</h1>"
config = AppConfig(minimal=True, root_controller=RootController())
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
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
or follow TurboGears on Google+ for the latest news!
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.