Skip to main content

python project load config from yaml or environment.

Project description

Abir--Python项目配置读取方案,yaml/environ

安装

pip install abir

快速上手

django project

  1. settings.py 底部添加
import abir  # at the top of settings.py

# another settings

abir.load()
  1. 在项目首页添加configure.yaml
DATABASES.default.ENGINE: 'django.db.backends.postgresql'
DATABASES.default.NAME: 'db_name'
CACHE:
  default:
    BACKEND: 'django_redis.cache.RedisCache'
    LOCATION: 'redis://127.0.0.1:6379/1'
    OPTIONS:
      CLIENT_CLASS: 'django_redis.client.DefaultClient'
LANGUAGE_CODE: 'zh-CN'
USE_TZ: true
ALLOWED_HOSTS:
  - *

⚠️ 注意:dot.将会查询settings.py,并更新查询路径下的值。

  1. 启动服务。
python manmage.py runserver
# or wsgi

environment

ABIR_USE_TZ:json=false
ABIR_LANGUAGE_CODE=es-us

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

abir-0.1.3.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

abir-0.1.3-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

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