ps的环境变量或参数中的金字塔服务器端口

2024-04-19 22:07:09 发布

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

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


Tags: 命令行pyramid参数服务器端环境变量pserve
1条回答
网友
1楼 · 发布于 2024-04-19 22:07:09

命令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

相关问题 更多 >