简体   繁体   English

重用粘贴配置条目

[英]Reusing paste config entry

I have the following Pyramid .ini file: 我有以下Pyramid .ini文件:

[DEFAULT]
redis.host = localhost
redis.port = 6379
redis.db = 0

[app:main]
...

# beaker session
session.type = redis
session.url = localhost:6379

In the app:main section's session.url I want to use what's defined under DEFAULT section's redis.host and redis.port . app:main部分的session.url我想使用DEFAULT部分的redis.hostredis.port下定义的redis.port

In my understanding everything under DEFAULT section is global and is passed to other sections. 据我了解, DEFAULT部分下的所有内容都是全局的,并将传递给其他部分。 But if I want to reuse a settings from DEFAULT and assign it a different name under other sections how do I do that? 但是,如果我想重用DEFAULT的设置并在其他部分下为其分配其他名称,该怎么办?

I'm looking at the same way I can reference section entry in buildout .cfg files using ${<section name>:<entry>} . 我正在寻找使用${<section name>:<entry>}来引用build.cfg文件中的节条目的方式。

session.url = %(redis.host)s:%(redis.port)s

应该做到的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM