Home:ALL Converter>Using Twisted static web server for sharing python resource files

Using Twisted static web server for sharing python resource files

Ask Time:2018-10-18T22:08:46         Author:grapes

Json Formatter

can anyone advice the best way to share Python package resource files with Twisted web server?

Package built using setuptools.

from pkg_resources import resource_listdir

from twisted.web.server import Site
from twisted.web.static import File
from twisted.internet import reactor

resource = File('/blah') # !! Wanna ask File use resource_listdir
factory = Site(resource)
reactor.listenTCP(8888, factory)
reactor.run()    

Author:grapes,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/52875917/using-twisted-static-web-server-for-sharing-python-resource-files
yy