hynek / svcs

A Flexible Service Locator for Python.
https://svcs.hynek.me
MIT License
294 stars 19 forks source link

Flask: Use app.extension instead of app.config #72

Closed hynek closed 7 months ago

hynek commented 8 months ago

This is a minor nit, but I find that app.config is usually filled with things which might be set from an external config.py file, environment variable, or some other source. I often even like to be able to render these things back to e.g. JSON to save the current configuration for debugging.

OTOH, flask provides app.extensions as a specific place for extensions to store state, and many flask extensions do that (e.g. Flask-SQLAlchemy).

What do you think about having svcs store the Registry object (which is managed by svcs, and wouldn't make much sense to set as the end user) in app.extensions?

Originally posted by @alexrudy in https://github.com/hynek/svcs/discussions/71

hynek commented 7 months ago

fixed by #73