gpt4 book ai didi

python - 环境变量或 pserve 参数中的 Pyramid 服务器端口

转载 作者:太空宇宙 更新时间:2023-11-04 07:20:17 26 4
gpt4 key购买 nike

我想通过环境变量或命令行参数指定 Pyramid 的服务器端口(使用默认 pserve)。以前有人这样做过吗?

最佳答案

pserve --help 命令告诉我们:

Usage: pserve-script.py config_uri [start|stop|restart|status] [var=value]

This command serves a web application that uses a PasteDeploy configuration file for the server and application. If start/stop/restart is given, then --daemon is implied, and it will start (normal operation), stop (--stop- daemon), or do both. You can also include variable assignments like 'http_port=8080' and then use %(http_port)s in your config files.

所以,例如:

[server:main]
use = egg:waitress#main
host = 127.0.0.1
port = %(http_port)s

并运行 pserve mydevapp.ini http_port=1234

关于python - 环境变量或 pserve 参数中的 Pyramid 服务器端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21227848/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com