Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/szastupov/setmeup
Runtime settings for minimalists
https://github.com/szastupov/setmeup
environment python settings
Last synced: 25 days ago
JSON representation
Runtime settings for minimalists
- Host: GitHub
- URL: https://github.com/szastupov/setmeup
- Owner: szastupov
- Created: 2017-04-09T00:28:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-10T13:02:57.000Z (over 7 years ago)
- Last Synced: 2024-11-21T18:48:15.510Z (about 1 month ago)
- Topics: environment, python, settings
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# setmeup [![Build Status](https://travis-ci.org/szastupov/setmeup.svg?branch=master)](https://travis-ci.org/szastupov/setmeup)
## Installation
$ pip install setmeup
## Usage
**setmeup.from_env** is a decorator that takes a class and overrides its fields with data from environment variables. That's pretty much all API.
```python
import setmeup# Define default settings
@setmeup.from_env
class Config:
DEBUG = False
PORT = 3000
APP_ENV = "dev"
ENABLE_HALLUCINATIONS = True# Just use Config's fields
print(Config.DEBUG)
print(Config.PORT)```
You can override any parameter via environment variable.
For example, setting `PORT=8080` before running the app sets Config.PORT to integer 8080. setmeup tries to use the same type as default value.## Usage with Flask
Since it's all about plain objects, you can easily use setmeup to populate Flask config:
```python
import Config from yoursettingsapp.config.from_object(Config)
```