Skip to main content

配置工具类

Project description

配置加载类使用说明

为部署的应用提供统一的配置文件解析接口。根据不同的应用名称生成不同的配置文件路径。并将其配置文件加载。

对一个应用appname,在Linux操作系统下,配置文件路径依次为

  • /etc/appname.ini
  • ${HOME}/etc/appname.ini
  • ${PROJECT_HOME}/etc.ini

在Windows下,配置文件的路径依次为

  • %ProgramData%/appname.ini
  • %APPDATA%/appname.ini
  • %PROJECT_HOME%/etc.ini

其中第三个路径为测试用的路径。后面的配置文件覆盖前面的配置。

类说明

该包提供类ConfigDict。其初始化函数接收一个参数appname。包含一个帮助方法self.show(),用以查看当前应用的配置文件路径。初始化完成后,ConfigDict的对象实例自动加载了所有的配置文件,以字典的形式存储在对象中。

config = ConfigDict(appname='app')
config.show()
print(config)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meca_common_config-1.0.3.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meca_common_config-1.0.3-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file meca_common_config-1.0.3.tar.gz.

File metadata

  • Download URL: meca_common_config-1.0.3.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for meca_common_config-1.0.3.tar.gz
Algorithm Hash digest
SHA256 67d2b638436c3e015d16375c9a2905172b94d978a83d47a122feca2feabfc148
MD5 14312d2def9b26b6c5226f8d981bbe27
BLAKE2b-256 bc7b086fe4594573362cce98cfde2557dae4cb2c2a38e1405a69078b36f1c1a5

See more details on using hashes here.

File details

Details for the file meca_common_config-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for meca_common_config-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 218e5886deb4f13f90ead4b6e5ce755cd8718f144d9f13056eb4f454e0acee11
MD5 d34063329fd643aed78013e218cb53cb
BLAKE2b-256 0299f076ce86243b52ac876bac9158b95e43040795ee3b2c8dc7d349c73c0ed8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page