Ultra simple settings management for (only) Python apps
Project description
Settings files are usual Python files that can contain valid python code however here are some guidelines for user
use module variables for global application wide configuration
Use UPPERCASE while naming settings variables
For values prefer basic python datatypes usch as string, integer, tuples
eg. SERVER_PORT = 1234
Avoid logic
Use simple classes for config sections
eg.
class DB: HOST = 'db.example.com' PORT = 1234
Use simple string operations to avoid repeatation
eg:
BASE_DOMAIN = 'example.com' API_URL = 'api.' + BASE_DOMAIN``
Supported settings files
Defaults: default_settings.py
- Mode
Production: prod_settings.py
Development: dev_settings.py
Test: test_settings.py
Deployment specific: site_settings.py
Setting mode
Create a file .app_mode This file would have just one line specifying settings (and hence app’s) mode.
Valid values are PROD | DEV | TEST
Based on mode appropriate settings module would be used (if available)
Overriding settings
Defining module veriables in site_settings.py
Example:
default_settings.py
SERVER_PORT = 9999
site_settings.py
SERVER_PORT = 8888
Overriding partial settings
Example:
default_settings.py
class DB: HOST = 'db.example.com' PORT = 1234
site_settings.py
DB.PORT = 1111
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file converge-0.1.tar.gz
.
File metadata
- Download URL: converge-0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02ee83255555340f0651b839ad72b5b2711e77a0500fa6922a2a6485d5656b5c |
|
MD5 | 53e2a15df83b9b7244fcfb4514dcd12b |
|
BLAKE2b-256 | 26c871817f568f6cde5b90c9f27c1bce5c07e6bcc6de8d2b8e06eaa7fe301060 |