金字塔中可以有多个ini配置文件吗? [英] Can I have multiple ini config files in Pyramid?

查看:90
本文介绍了金字塔中可以有多个ini配置文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要等效的 Django One True Way 设置布局:共享的基础文件,然后是生产文件和开发文件,每个文件都导入共享的基础.

I'd like an equivalent of the Django One True Way settings layout: a shared base file, and then a production file and a development file, each of which import the shared base.

Pyramid的配置有可能吗?

Is this possible with Pyramid's config?

推荐答案

可以.在我的一个项目中,我有一个production_base.ini文件,所有其他生产inis都从该文件继承:

Yes that's possible. In one of my projects I have a production_base.ini file and all other production inis inherit from it:

production_base.ini

[app:main]
use = egg:xxx
maintenance_mode = False

production_www.ini

[app:main]
use = config:production_base.ini
maintenance_mode = True  # overwrites the value in the base ini

您还可以检查粘贴文档有关更多示例.

You can also check paste docs for more examples.

旁注-但是您不能继承日志记录部分.

Side note - you can't inherit logging section though.

这篇关于金字塔中可以有多个ini配置文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆