How to get the app in a command if it came from a factory function
mchaput opened this issue · 2 comments
mchaput commented
Looking at http://flask-script.readthedocs.org/en/latest/ you explain how to use a factory function and add a config
option to the manager. This is exactly what I need, so I was excited to see it. However, you then show this example of a command using the configuration:
@manager.command
def hello(name):
uppercase = app.config.get('USE_UPPERCASE', False)
if uppercase:
name = name.upper()
print "hello", name
AFAICT this won't work because in this example there is no pre-configured app
global... the app is generated at runtime from a factory. How can I access the app inside a command if I used a factory function? Thanks!
davidism commented
Use current_app
.
mchaput commented
Of course! Thanks :)