I have a large flask application built inside a package called "MyApp" (exactly as shown here: http://flask.pocoo.org/docs/0.12/patterns/packages/)
According to the Flask documentation, the debug mode should enables the following features:
- it activates the debugger
- it activates the automatic reloader
- it enables the debug mode on the Flask application.
At the beginning I've run my flask application with the following command and everything were worked fine:
export FLASK_APP=MyApp
export FLASK_DEBUG=1
flask run
Then I read about the correct way to setup a configuration system (including the debug mode). So I created the following config.py file:
class Config(object):
DEBUG = False
...
class ProductionConfig(Config):
...
class DevelopmentConfig(Config):
DEVELOPMENT = True
DEBUG = True
...
CONFIGS = {
"development": DevelopmentConfig,
"production": ProductionConfig,
"default": DevelopmentConfig
}
And in my application __init__.py file, I wrote:
app = Flask(__name__)
config_name = os.getenv('FLASK_CONFIGURATION', 'default')
app.config.from_object(CONFIGS[config_name])
Now, to run the application I enter a new command:
export FLASK_APP=MyApp
export FLASK_CONFIGURATION=development
flask run
Unfortunately, this time the debug mode did not activated at all..
No debugger or automatic reloader has been activated.
The only thing that has been changed was that app.debug is now equals to True.
I don't get it.. It looks like the DEBUG = TRUE is not working correctly.
Do you have any idea why does it happen?