Python Projects Configuration Manager
Project description
Myconfig
Quick start
Install
pip install myconfig
Initialize Myconfig on project root directory
cd project/path/
myconfig init json
Configuring your Python project environment
--------------------------------------------
File `settings.py` was created.
The `settings.json` file was created to hold public settings and `.secrets.json` file was created to hold private settings.
Also `.secrets.*` was added to `.gitignore`.
You can also use other formats: myconfig init <format> (json | yaml | toml)
Using Myconfig
Add to settings.py
common project settings:
{
"username": "admin",
"ips": ["127.0.0.1", "198.*.*.*"],
"database": {
"name": "database_name",
"port": 5555}
}
Or put private settings in .secrets.py
:
{
"password": 53156
}
Import the config
object from settings.py
in your code
from settings import config
print(config.username)
print(config.database.get('name'))
File
settings.py
from myconfig import MyConfig config = MyConfig(['settings.json', '.secrets.json'])
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
myconfig-0.2.0.tar.gz
(3.9 kB
view hashes)