Add Flask.config_class attribute #775

merged 1 commit into from Feb 20, 2014

3 participants


Similar to request_class, response_class and app_ctx_globals_class, the config_class attribute of Flask allows to specify custom class that stores the configuration for the app:

import flask

class Config(flask.Config):
    def __getitem__(self, key):
            return super(Config, self).__getitem__(key)
        except KeyError:
            return None

class Flask(flask.Flask):
    config_class = Config

The current alternative is to override make_config and repeat its logic (such as handling of instance_relative argument). This should be more convenient and robust.


@Xion, it looks like your pull request's build fails on Python 2.6:

Once the build passes, is this something the maintainers are interested in including? I think it seems useful, e.g. for adding custom app.config.from_ methods.

@DasIch DasIch merged commit ec5b182 into pallets:master Feb 20, 2014

1 check failed

Details default The Travis CI build failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment