Flask does not load configuration
<p>I am facing trouble with loading configuration in Flask.</p>

<pre><code>from config import config, DevelopmentConfig, TestingConfig, ProductionConfig

def create_app(config_name):
    app = Flask(__name__)
    app.config.from_object(config[config_name])    # Doesnot load configuration
    app.config.from_object(DevelopmentConfig)    # Loads configuration succesfully.
</code></pre>

<p>I have checked the type of config[config_name] etc. They are just fine.</p>

<p><strong>config file</strong> is given as follow. There are no issues with import, object types. If passed statically everything works fine. 
'host'='serverip' is intentional.</p>

<p>Also, this problem does not arise when I try to connect to db using SQLAlchemy but in case of MongoDB, it does not update MONGODB_SETTINGS in application settings.</p>

<pre><code>import os
basedir = os.path.abspath(os.path.dirname(__file__))

from helper.helper_functions import generate_secret_key

class Config:
    SECRET_KEY = os.environ.get('SECRET_KEY') or generate_secret_key()
    SSL_DISABLE = False

    @staticmethod
    def init_app(app):
        pass


class DevelopmentConfig(Config):
   DEBUG = True
    MONGODB_SETTINGS = {
        'DB': 'development_db',
        'host': 'localhost',
       'port': 27017
    }


class TestingConfig(Config):
    TESTING = True
    WTF_CSRF_ENABLED = False
    MONGODB_SETTINGS = {
        'DB': 'testing_db',
        'HOST': 'localhost',
        'PORT': 27017
    }


class ProductionConfig(Config):
    MONGODB_SETTINGS = {
        'DB': 'production_db',
        'host': 'server_ip',
        'port': 27017,       # default =27017
        # other settings...
    }

    @classmethod
    def init_app(app):
        Config.init_app(app)

config = {
    'development': DevelopmentConfig,
    'testing': TestingConfig,
    'production': ProductionConfig,
    'default': TestingConfig,
}
</code></pre>

<p><strong>Interestingly</strong>.</p>

<pre><code>app.config.update(MONGODB_SETTINGS={'DB':'testing_db'})   # works
settings = dict([('db', 'testing_db')])
app.config.update(MONGODB_SETTINGS=settings)    # Does not work
</code></pre>

<p>Also, when I try to load configuration from configuration file using the other method offered by Flask-Config.</p>

<pre><code>conf_name = 'test-config.py'
app.config.pyfile(conf_name)    # Doesnot load the configuration from the file.
app.config.pyfile(''+conf_name)    # Doesnot load the configuration from the file.
app.config.pyfile('test-config.py')    #successfully loads the configuration from file.
</code></pre>