view.config
¶
B_CLOSE = '}'
module-attribute
¶
B_OC = '{}'
module-attribute
¶
B_OPEN = '{'
module-attribute
¶
AppConfig
¶
Bases: ConfigModel
app_path: str = ConfigField('app.py:app')
class-attribute
instance-attribute
¶
loader: Literal['manual', 'simple', 'filesystem', 'patterns'] = 'manual'
class-attribute
instance-attribute
¶
loader_path: Path = Path('./routes')
class-attribute
instance-attribute
¶
uvloop: Union[Literal['decide'], bool] = 'decide'
class-attribute
instance-attribute
¶
validate_loader(loader: str)
classmethod
¶
validate_loader_path(loader_path: Path, values: dict)
classmethod
¶
Config
¶
Bases: ConfigModel
app: AppConfig = ConfigField(default_factory=AppConfig)
class-attribute
instance-attribute
¶
dev: bool = True
class-attribute
instance-attribute
¶
env: Dict[str, Any] = ConfigField(default_factory=dict)
class-attribute
instance-attribute
¶
log: LogConfig = ConfigField(default_factory=LogConfig)
class-attribute
instance-attribute
¶
server: ServerConfig = ConfigField(default_factory=ServerConfig)
class-attribute
instance-attribute
¶
templates: TemplatesConfig = ConfigField(default_factory=TemplatesConfig)
class-attribute
instance-attribute
¶
DatabaseConfig
¶
Bases: ConfigModel
mongo: Union[MongoConfig, None] = None
class-attribute
instance-attribute
¶
mysql: Union[MySQLConfig, None] = None
class-attribute
instance-attribute
¶
postgres: Union[PostgresConfig, None] = None
class-attribute
instance-attribute
¶
sqlite: Union[SQLiteConfig, None] = SQLiteConfig(file='view.db')
class-attribute
instance-attribute
¶
type: Literal['sqlite', 'mysql', 'postgres', 'mongo'] = 'sqlite'
class-attribute
instance-attribute
¶
LogConfig
¶
Bases: ConfigModel
fancy: bool = True
class-attribute
instance-attribute
¶
level: Union[Literal['debug', 'info', 'warning', 'error', 'critical'], int] = 'info'
class-attribute
instance-attribute
¶
pretty_tracebacks: bool = True
class-attribute
instance-attribute
¶
server_logger: bool = False
class-attribute
instance-attribute
¶
startup_message: bool = True
class-attribute
instance-attribute
¶
user: UserLogConfig = ConfigField(default_factory=UserLogConfig)
class-attribute
instance-attribute
¶
MongoConfig
¶
MySQLConfig
¶
PostgresConfig
¶
ServerConfig
¶
Bases: ConfigModel
backend: Literal['uvicorn', 'hypercorn', 'daphne'] = 'uvicorn'
class-attribute
instance-attribute
¶
extra_args: Dict[str, Any] = ConfigField(default_factory=dict)
class-attribute
instance-attribute
¶
host: IPv4Address = IPv4Address('0.0.0.0')
class-attribute
instance-attribute
¶
port: int = 5000
class-attribute
instance-attribute
¶
TemplatesConfig
¶
UserLogConfig
¶
Bases: ConfigModel
file_write: FileWriteMethod = 'both'
class-attribute
instance-attribute
¶
log_file: Union[Path, str, None] = None
class-attribute
instance-attribute
¶
show_caller: bool = True
class-attribute
instance-attribute
¶
show_color: bool = True
class-attribute
instance-attribute
¶
show_time: bool = True
class-attribute
instance-attribute
¶
show_urgency: bool = True
class-attribute
instance-attribute
¶
strftime: str = '%H:%M:%S'
class-attribute
instance-attribute
¶
urgency: Urgency = 'info'
class-attribute
instance-attribute
¶
load_config(path: Path | None = None, *, directory: Path | None = None) -> Config
¶Load the configuration file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Path | None
|
Path to get the configuration from. |
None
|
directory |
Path | None
|
Where to look for the configuration. |
None
|
make_preset(tp: str, loader: str) -> str
¶