我有一个简单的.tac文件和一个简单的服务,我从以下几个方面开始:
twistd -y service.tac一切都很好。但是在tac文件中,我已经为我的服务提供了一个硬编码端口,我想让它变得动态。我最想让它工作的方式是通过标准unix命令行参数:
twistd -y service.tac --port 8081然后,我想访问port变量在.tac文件中的某个位置。就像标准python模块一样:opt解译和and解析。我在Twisted中寻找这样的解决方案,我只找到了https://twistedmatrix.com/documents/12.0.0/core/howto/options.html#auto6,恐怕这不是我所需要的,因为我得到了这个错误:
$ twistd -y service.tac
/usr/bin/twistd: option -y not recognized
/usr/bin/twistd: Try --help for usage details.有人知道如何将twistd工具参数化吗?
发布于 2013-11-02 10:20:10
似乎扭曲的方法在这里被记录下来了:
https://twistedmatrix.com/documents/12.0.0/core/howto/tap.html
您编写的插件添加了“子命令”,可以通过CLI使用
https://stackoverflow.com/questions/19733812
复制相似问题