Skip to main content

Flask-WaffleConf PyPI version

WaffleConf is a Flask extension that enables storage of configuration variables in the database as well as runtime modification of said variables.

Released under GPLv2+ license.

Installation

$ pip install Flask-WaffleConf

Configuration

Simple usage of the extension requires the following configuration variables (e.g., in your application’s config.py):

  • WAFFLE_CONFS: used for specifying the configuration variables that are going to be stored in the database. It has the following structure:

WAFFLE_CONFS = {
    'MAX_FILESIZE': {
        'desc': 'Max upload filesize (in bytes)',
        'default': 1000
    },

    'SITENAME': {
        'desc': 'Name of the site appearing in the header',
        'default': 'Waffle'
    }
}

Check the documentation for advanced usage

Example Application using SQLAlchemy as ORM

from flask import Flask, current_app
from flask_waffleconf import WaffleConf, AlchemyWaffleStore, \
    WaffleMixin
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['WAFFLE_CONFS'] = {
    'MAX_FILESIZE': {
        'desc': 'Max upload filesize (in bytes)',
        'default': 1000
    },

    'SITENAME': {
        'desc': 'Name of the site appearing in the header',
        'default': 'Waffle'
    }
}

# Define your database
# db = ...

# Define model
class ConfModel(db.Model, WaffleMixin):
    __tablename__ = 'confs'

    id = db.Column(db.Integer, primary_key=True)
    key = db.Column(db.String(255), unique=True)
    value = db.Column(db.Text)

# Create database tables
# ...

# Initialize WaffleConf
configstore = AlchemyWaffleStore(db=db, model=ConfModel)
waffle = WaffleConf(app, configstore)

@app.route('/')
def index():
    """Display content of configured variable 'SITENAME'."""
    state = current_app.extensions['waffleconf']

    parsed = state.parse_conf()
    # {'MAX_FILESIZE': 1000, 'SITENAME': 'Waffle'}

    return parsed['SITENAME']

Multiprocess deployments

Since version 0.2.0, multiprocess deployments are supported. Check the documentation for more information.

Documentation

Documentation is present in the docs/ directory and also online at https://flask-waffleconf.readthedocs.org. In order to build the documentation from source (you will need Sphinx), run the following command in the docs/ directory:

$ make html

Metadata

Release files for Flask-WaffleConf 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-WaffleConf 0.3.1
File Size Uploaded Provenance
Flask-WaffleConf-0.3.1.tar.gz 23.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for Flask-WaffleConf 0.3.1
File Interpreter ABI Platform
Flask_WaffleConf-0.3.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 44.8 kB

Release files / Flask-WaffleConf-0.3.1.tar.gz

Download URL Flask-WaffleConf-0.3.1.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d318b9462efa7dec7824bf8bf1336d590085d3dee1e7aa15023e00cdbd718090
BLAKE2b-256 checksum
How to use checksums
9e6a1386676d61c6687d1974d174184279cced3a7da1dcfc687592af78dc1eaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Flask_WaffleConf-0.3.1-py2.py3-none-any.whl

Download URL Flask_WaffleConf-0.3.1-py2.py3-none-any.whl
Size 21.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ee4f1fc5edf75f8a2639eb15e6f6ae135e1a0cd58b028b65d08fab13b4a29a1d
BLAKE2b-256 checksum
How to use checksums
0e5eb1e5cce48c16071579e269438d6a3c6c4a7859b9b6e69627f0cf455f93ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Flask-WaffleConf 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page