0
# Configuration Management
1
2
Flask provides a flexible configuration system for managing application settings from various sources.
3
4
## Capabilities
5
6
### Config Class
7
8
```python { .api }
9
class Config(dict):
10
def from_envvar(self, variable_name: str, silent: bool = False) -> bool: ...
11
def from_file(self, filename: str, load: Callable = None, silent: bool = False) -> bool: ...
12
def from_object(self, obj) -> None: ...
13
def from_prefixed_env(self, prefix: str = "FLASK", *, loads: Callable = None) -> bool: ...
14
def get_namespace(self, namespace: str, lowercase: bool = True, trim_namespace: bool = True) -> dict: ...
15
```
16
17
## Usage Examples
18
19
### Basic Configuration
20
21
```python
22
from flask import Flask
23
24
app = Flask(__name__)
25
26
# Direct configuration
27
app.config['SECRET_KEY'] = 'your-secret-key'
28
app.config['DEBUG'] = True
29
30
# Load from object
31
app.config.from_object('config.DevelopmentConfig')
32
33
# Load from environment variable
34
app.config.from_envvar('APP_SETTINGS')
35
```