如何在python金字塔应用程序中获取服务主机和端口?

如何在python金字塔应用程序中获取服务主机和端口?,python,settings,pyramid,Python,Settings,Pyramid,我正在尝试使用以下方法获取金字塔应用程序的服务主机和端口: settings = get_current_registry().settings 但是我怎样才能得到主人呢 我试过: settings.get('host') 但是我得到了无 非常感谢您的帮助 request.host or request.host_url 默认情况下,python pyramid使用pserve,您可以使用mod_wsgi和uwsgi运行pyramid 金字塔服务主机和端口存在于development.in

我正在尝试使用以下方法获取金字塔应用程序的服务主机和端口:

settings = get_current_registry().settings
但是我怎样才能得到主人呢

我试过:

settings.get('host')
但是我得到了

非常感谢您的帮助

request.host or request.host_url

默认情况下,python pyramid使用pserve,您可以使用mod_wsgiuwsgi运行pyramid

金字塔服务主机和端口存在于development.ini和production.ini文件中

对于pserve:

对于Uwsgi:

您可以更改此端口

运行命令:

pserve development.ini
uwsgi development.ini 

Pyramid可以运行在托管在多个地址和端口上的WSGI服务器中;这不是金字塔配置可以看到的东西。使用请求对象信息查看浏览器为每个请求联系的地址。
[uwsgi]
http = :9090
paste = config:project_url/test/development.ini**(set your directory)**
master = true
processes = 4
threads = 2
pserve development.ini
uwsgi development.ini