TurboGears是一个混合Web框架,既可以作为Full Stack框架,也可以作为Microframework

网友投稿 615 2022-10-21

TurboGears是一个混合Web框架,既可以作为Full Stack框架,也可以作为Microframework

TurboGears是一个混合Web框架,既可以作为Full Stack框架,也可以作为Microframework

TurboGears

TurboGears is a hybrid web framework able to act both as a Full Stack framework or as a Microframework. TurboGears helps you get going fast and gets out of your way when you want it!

TurboGears can be used both as a full stack framework or as a microframework in single file mode.

Get Started

To try TurboGears just get pip if you don't already have it:

$ curl -O 'https://bootstrap.pypa.io/get-pip.py'$ python get-pip.py

And install Turbogears:

$ pip install TurboGears2

Then serving a TurboGears web application is as simple as making a webapp.py file with your application:

from wsgiref.simple_server import make_serverfrom tg import MinimalApplicationConfiguratorfrom 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()

Start it with python webapp.py and open your browser at http://localhost:8080/

Want to play further with TurboGears? Try the TurboGears Tutorials:

Getting Started with TurbogearsBuilding a Wiki in 20 minutes

Support and Documentation

Visit TurboGears Documentation for complete documentation and tutorials.

See the TurboGears website to get a quick overview of the framework and look for support.

License

TurboGears is licensed under an MIT-style license (see LICENSE.txt). Other incorporated projects may be licensed under different licenses. All licenses allow for non-commercial and commercial use.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Springboot使用filter对response内容进行加密方式
下一篇:RabbitMQ基本概念和Linux安装配置RabbitMQ
相关文章

 发表评论

暂时没有评论,来抢沙发吧~