admin
admin
3499 0 0

gevent+itty 不错的新组合

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

https://github.com/toastdriven/itty

示例

from itty import get, run_itty

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

run_itty()

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

from itty import *

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

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

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

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

run_itty()


0

See Also

Nearby


Discussion

Login Topics