分页: 1 / 1

微型Web应用程序框架Featherweb

发表于 : 2020年 4月 27日 09:12
shaoziyang
Featherweb是一个适用于MicroPython和esp8266的精简型Web应用程序框架,只需要很少的RAM和资源就可以运行。


Example

代码: 全选

import featherweb
import gc

app = featherweb.FeatherWeb()

@app.route('/hello')
def Hello(request):
    """ Say Jello! """
    request.send("Jello!")

@app.route('/example.py')
def ExamplePy(request):
    """ Serve a binary file. """
    request.sendfile('/example.py')

def TimeoutCB():
    """ I'm bored.  What else needs to be done... """
    print("We came up for air.  May as well pick up the trash...")
    gc.collect()
    return True

app.run(callback=TimeoutCB)
 

Re: 微型Web应用程序框架Featherweb

发表于 : 2020年 4月 27日 14:58
dukeduck
我之前几个项目用了MicroWebSrv,也很好用,写起来跟Flask差不多

https://github.com/jczic/MicroWebSrv

现在更新到MicroWebSrv2,好像是使用了uasyncio支持异步

https://github.com/jczic/MicroWebSrv2

Re: 微型Web应用程序框架Featherweb

发表于 : 2020年 4月 27日 17:08
shaoziyang
MicroWebSrv也挺不错的