如何使用twisted服务外部文件夹?

2024-09-27 21:33:34 发布

您现在位置:Python中文网/ 问答频道 /正文

python中有一个captiveportal脚本可以与twisted一起使用,但它会在脚本中加载门户页面(search CAPTIVE_TEMPLATE)

https://github.com/bendemott/captiveportal/blob/master/captiveportal

我怎样才能装载一个完整的索引.html文件夹与js和css和其他材料,如文件和扭曲?在

谨致问候


Tags: httpsgithubmaster脚本comsearch门户html
1条回答
网友
1楼 · 发布于 2024-09-27 21:33:34

使用文件并传递给它一个目录。在

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

resource = File('/tmp')
factory = Site(resource)
reactor.listenTCP(8888, factory)
reactor.run()

查看更多here

相关问题 更多 >

    热门问题