Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé
Classe « Config »

Méthode flask.Config.get_namespace

Signature de la méthode get_namespace

def get_namespace(self, namespace: 'str', lowercase: 'bool' = True, trim_namespace: 'bool' = True) -> 'dict[str, t.Any]' 

Description

help(Config.get_namespace)

Returns a dictionary containing a subset of configuration options
that match the specified namespace/prefix. Example usage::

    app.config['IMAGE_STORE_TYPE'] = 'fs'
    app.config['IMAGE_STORE_PATH'] = '/var/app/images'
    app.config['IMAGE_STORE_BASE_URL'] = 'http://img.website.com'
    image_store_config = app.config.get_namespace('IMAGE_STORE_')

The resulting dictionary `image_store_config` would look like::

    {
        'type': 'fs',
        'path': '/var/app/images',
        'base_url': 'http://img.website.com'
    }

This is often useful when configuration options map directly to
keyword arguments in functions or class constructors.

:param namespace: a configuration namespace
:param lowercase: a flag indicating if the keys of the resulting
                  dictionary should be lowercase
:param trim_namespace: a flag indicating if the keys of the resulting
                  dictionary should not include the namespace

.. versionadded:: 0.11


Vous êtes un professionnel et vous avez besoin d'une formation ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé