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

Bottle

Bottle
开发者Marcel Hellkamp
首次发布2009年7月1日,​15年前​(2009-07-01
当前版本
  • 0.12.25 (2023年3月4日)[1]
编辑维基数据链接
原始码库Bottle Repository
编程语言Python
操作系统跨平台
类型Web应用框架
许可协议MIT许可证
网站bottlepy.org 编辑维基数据链接

Bottle是一个用于Python编程语言的WSGI微web框架英语Microframework。它被设计为快速、简单和轻量的,可以容易的和快速的开发web应用[2]。它被作为一个单一文件模块发行,不依赖于其他的Python标准库。同一个模块可运行于Python 2.7和3.x[3]

它提供了具有URL参数支持的请求分派(路由)、模板英语Comparison of web template engines、内建web伺服器和对很多第三方WSGI/HTTP伺服器和模板引擎英语Web template system的适配器[4]

特征

  • 单一文件可以运行于Python 2.7和3.x二者。
  • 可以运行为独立web伺服器或用在(“挂装”)支持WSGI的任何web伺服器之后。
  • 内建了叫做SimpleTemplate引擎的模板引擎。
  • 支持JSON客户端数据(对于RESTJavaScript客户端)。
  • 对数据库和键/值存储和其他特征的插件[5]

例子

简单的Hello World!程序:

from bottle import route, run, template

@route('/hello/<name>')
def index(name):
    return template('<b>Hello ((name))</b>!', name=name)

run(host='localhost', port=8080)

参见

引用

  1. ^ Release 0.12.25. 2023年3月4日 [2023年3月8日]. 
  2. ^ Digital Ocean Bottle tutorial. [2021-03-12]. (原始内容存档于2020-12-02). 
  3. ^ Bottle website. [2021-03-12]. (原始内容存档于2014-06-04). 
  4. ^ Web Frameworks for Python. [2021-03-12]. (原始内容存档于2021-05-17). 
  5. ^ List of available Plugins. [2021-03-12]. (原始内容存档于2015-09-09). 

外部链接

{{bottomLinkPreText}} {{bottomLinkText}}
Bottle
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?