Skip to main content

Flask-Configurator

Env and file based configuration for Flask

Installation

pip install flask-configurator

Usage

from flask import Flask
from flask_configurator import Configurator

app = Flask(__name__)
Configurator(app)

By default this will load configuration from:

  • environment variables with the FLASK_ prefix
  • .env (only variables with the FLASK_ prefix)
  • .env.ENV (only variables with the FLASK_ prefix)
  • config.yml
  • config.ENV.yml

Where ENV is the environment defined as defined by:

  1. development if app.debug, production otherwise
  2. FLASK_ENV environment variable
  3. ENV key from any loaded file

Options

Configurator(
    app,
    default_file="config.yml", # default configuration file to load from (set to None to disable)
    env_prefix="FLASK", # environment variable prefix
    default_env="production", # default env name (None for default, False to not set any env)
)

Supported configuration formats: yml, json, toml.

Manual loading

Rather than going through an extension, you can use our custom Config class.

from flask_configurator import Config
config = Config()
config.load()
print(config["KEY"])
app.config.update(config)

Use it as your flask config class:

from flask import Flask
from flask_configurator import Config

class CustomFlask(Flask):
    config_class = Config

app = CustomFlask(__name__)
app.config.load()

Metadata

Release files for flask-configurator 0.1.2

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-configurator 0.1.2
File Size Uploaded
flask_configurator-0.1.2.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-configurator 0.1.2
File Interpreter ABI Platform
flask_configurator-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.9 kB

Release files / flask_configurator-0.1.2.tar.gz

Download URL flask_configurator-0.1.2.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
51a51aad342ed421c53410240204f3ea8375712f003cf98d392cc689dc576187
BLAKE2b-256 checksum
How to use checksums
9190f2be9816b62b575baa4b94c39b9651377c6bb37f250f6c4133de2ddf21f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.0

Release files / flask_configurator-0.1.2-py3-none-any.whl

Download URL flask_configurator-0.1.2-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b63df3706a6b6ad2b066eeedac2a8d40c6f17e6006faad8030dd785a3302b95
BLAKE2b-256 checksum
How to use checksums
0acd6d7b6580207b6b61e7527bb84dcfe4afe9278b1c490737fd788b1d780040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.0

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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