用法
bench set-config [OPTIONS] KEY VALUE
说明
Bench 提供了一个包装命令,用于在站点配置文件中插入或更新值。
你可以通过同一个命令更新站点中的 site_config.json,以及
bench 目录中的 common_site_config.json。
如需了解更多关于站点配置和键优先级的内容,请参阅
此处的文档。
参数
-g,--global在 Bench 的通用站点配置中设置值-p,--parse解析给定的值而不是按字符串处理。你可以用它来设置
字典和列表类型的值。在早期版本中,这个参数是--as-dict。
示例
- 为指定站点启用测试。
bench --site {site} set-config allow_tests true
- 为所有站点启用测试。
bench --site all set-config allow_tests true
使用上面的命令,每个站点的 site_config.json 中都会有
键值对 "allow_tests": true。这样就可以在所有
站点上运行测试了。
bench set-config -g allow_tests true
使用上面的命令,bench 的 common_site_config.json 中会有
键值对 "allow_tests": true。这样 bench 上的每个站点都可以
运行测试,除非它们在 site_config.json 中为 sma 定义了
值。
- 在站点的
frappe.conf中设置一个字典值
bench --site {site} set-config backup '{"includes": ["Not", "ToDo"]}' --parse
现在你可以在代码中通过 frappe.conf.backup.get("includes") 来访问这个列表。