gevent+itty 不错的新组合

By admin at 2014-02-06 17:48 • 1405次点击
admin

itty 一个新的python web 框架,代码风格跟bottle 相似。作者是Django 界很有名。

https://github.com/toastdriven/itty 1

示例

from itty import get, run_itty

 @[get](/member/get) ('/')
def index(request):
    return 'Hello World!'

run_itty()

######################

from itty import *

 @[get](/member/get) ('/get/(?P<name>\w+)')
def test_get(request, name=', world'):
    return 'Hello %s!' % name

 @[post](/member/post) ('/post')
def test_post(request):
    return "'foo' is: %s" % request.POST.get('foo', 'not specified')

 @[put](/member/put) ('/put')
def test_put(request):
    return "'foo' is: %s" % request.PUT.get('foo', 'not specified')

 @[delete](/member/delete) ('/delete')
def test_delete(request):
    return 'Method received was %s.' % request.method

run_itty()



gevent, itty, 组合, 不错


目前尚无回复
登录 后发表评论