asgi实现为一个扭曲的资源
txasgiresource的Python项目详细描述
txasgiresource是ASGI实现为一个扭曲的web资源, 非常类似于WSGIResource。
这是受Daphne启发的,但有些是从规范实现的。
它也可以作为守护进程运行。
代码可在GitHub
用法
作为扭曲资源
fromtwisted.webimportserverfromyourdjangoproject.routingimportapplicationresource=ASGIResource(application)site=server.Site(resource)# If we are done with the resource, make sure to stop it.yieldresource.stop()
作为asgi协议服务器
twistd -n txasgi -a yourdjangoproject.routing:application
作为不同端口和IP上的ASGi协议服务器
twistd -n txasgi -a yourdjangoproject.asgi:channel_layer -d tcp:5566:interface=0.0.0.0
许可证
麻省理工学院,请参见许可证