For faster navigation, this Iframe is preloading the Wikiwand page for Pylons.

Pylons

Pylons计划
网站类型
Python框架开发
语言English
持有者开源
编辑匿名
网址pylonsproject.org 编辑维基数据链接
商业性质No
注册None
推出时间2010年12月27日 (2010-12-27)
现状活跃

Pylons计划是开发一组用Python书写的web应用技术的开源组织。最初这个计划只是一个叫做Pylons的单一的web框架,但是后来合并了repoze.bfg框架,并取了新名字Pyramid,Pylons计划现在由多个有关的web应用技术组成。

Pyramid

Pyramid
开发者Chris McDonough, Ben Bangert, Michael Merickel, Bert JW Regeer, Steve Piercy
首次发布2008年7月8日,​16年前​(2008-07-08[1]
源代码库www.github.com/Pylons/pyramid
编程语言Python
操作系统跨平台
类型Web应用框架
许可协议BSD License
网站trypyramid.com

Pyramid是用Python书写的开源web应用框架,它基于了WSGI。它是受到ZopePylonsDjango启发的极简主义的web框架[3]

Pyramid最初叫做“repoze.bfg”,它获得关注主要在于Zope[4]Plone社区,随着开放社会基金会的KARL计划从Plone迁移至BFG[5]。在2010年宣布了Pylons框架将于版本1.5转移到使用BFG作为基础[6]。作为将BFG包括入Pylons计划的结果,BFG被重命名为Pyramid[7]

特征

Pyramid是极简主义的跨平台web框架。它不预定持久化方式,可以通过SQLAlchemy集成于SQL数据库或集成于Zope对象数据库英语Zope Object Database二者,还有其他NoSQL数据库比如CouchDB[3]

Pyramid允许开发者使用正则表达式定义映射到对象的路由。同样跟从框架Zope,Pyramid允许层级对象遍历,这里URL的每个部分都是包含其他对象的对象,这种方式类似于文件系统中的文件夹[8]

例子代码

from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response

def hello_world(request):
    return Response('Hello World!')

if __name__ == '__main__':
    with Configurator() as config:
        config.add_route('hello', '/')
        config.add_view(hello_world, route_name='hello')
        app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 6543, app)
    server.serve_forever()

Pylons框架

Pylons框架
开发者Ben Bangert, James Gardner
首次发布2005年9月,​18年前​(2005-09[9]
编程语言Python
操作系统跨平台
类型Web应用框架
许可协议BSD license
网站pylonsproject.org/about-pylons-framework.html

Pylons是一个开放源代码Web应用框架,使用Python语言编写。它对WSGI标准进行了扩展应用,提升了重用性且将功能分割到独立的模块中。

Pylons类似于DjangoTurboGears。Pylons受Ruby on Rails影响很深:它的两个组件,Routes[11]和WebHelpers[12]是Rails特性的Python实现。

安装和依赖

Pylons的官方安装方法是从Python CheeseShop[13]下载使用EasyInstall[14]完成,而大部分的附加工具也通常以相同方式安装。

URL分派

Pylons普遍使用的URL分派器是Routes[11],实际是Ruby on Rails的URL分派的Python重新实现,其他的URL分派器只要是WSGI兼容也可以使用,例如Selector[15]

HTML生成

另一个从Rails Pylons化的部分是WebHelpers[16],它提供了基于路径的URL映射。WebHelpers也提供了一些实用的功能来生成基于script.aculo.us英语script.aculo.usPrototype库的JavaScript代码。

模板

Myghty是缺省的Pylons模板语言,但在版本0.9.6它被替代为Mako[17]。也可以使用其他模板语比如Genshi英语Genshi (templating language)[18]

数据库抽象和对象关系映射

Pylons没有默认的数据库程序库。可以使用比较有名的SQLObjectSQLAlchemy

另见

参考

  1. ^ Pyramid Change History. The Pyramid Web Framework. Pylons Project. [10 March 2017]. (原始内容存档于2021-01-01). 
  2. ^ Release 2.0.2. 2023年8月25日 [2023年9月19日]. 
  3. ^ 3.0 3.1 Chris McDonough. repoze.bfg introduction. [2010-09-21]. (原始内容存档于2013-12-30). 
  4. ^ Gary Poster. Zope Summit, DZUG, repoze.bfg. 2010-09-17 [2010-09-21]. (原始内容存档于2011-08-13). 
  5. ^ Thomas Moroz, Chris Rossi & Calvin Hendryx-Parker. KARL – large-scale Knowledge Management. Budapest, Hungary: Plone Conference 2009. 2009-10-28 [2010-09-23]. (原始内容存档于2010-06-02). 
  6. ^ Ben Bangert. Emails explaining the Pylons 2 structure. 2010-09-18 [2010-09-21]. (原始内容存档于2022-04-01). 
  7. ^ repoze.bfg is now Pyramid. [2011-01-03]. (原始内容存档于2010-11-13). 
  8. ^ Wichert Akkerman. Lessons from other frameworks. Budapest, Hungary: Plone Conference 2009. 事件发生在 25:50. 2009-10-28 [2010-09-21]. (原始内容存档于2013-04-18). 
  9. ^ History of Pylons. [2020-11-01]. (原始内容存档于2020-07-07). 
  10. ^ Release 1.0.2. 2015年7月22日 [2018年7月22日]. 
  11. ^ 11.0 11.1 Routes
  12. ^ WebHelpers. [2015-12-15]. 原始内容存档于2015-12-22. 
  13. ^ Python CheeseShop. [2008-08-11]. 原始内容存档于2008-07-19. 
  14. ^ EasyInstall
  15. ^ Selector
  16. ^ WebHelpers
  17. ^ Haas, Christoph Beginning Pylons 互联网档案馆存档,存档日期2009-02-16.. Retrieved July 5, 2007
  18. ^ Genshi Wiki Pylons with Genshi页面存档备份,存于互联网档案馆) Retrieved July 5, 2007

外部链接

{{bottomLinkPreText}} {{bottomLinkText}}
Pylons
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?