I have a flask app running, I want something what can interacts with it. Let me explain it with the next example:
Flask app:
from flask import Flask
MyApp = Flask(__name__)
mytext = "Hello World!"
@app.route('/')
def hello_world():
return mytext
def text_reload():
global mytext
mytext = "Hey! I have been reloaded!"
if __name__ == '__main__':
MyApp.run()
Flask-Script (manager.py):
from flask.ext.script import Manager
from myapp import MyApp
manager = Manager(MyApp)
@manager.command
def reload_mytext():
**DO SOME MAGIC HERE**
if __name__ == '__main__':
manager.run()
That reload_mytext()
calls text_reload()
function from within the app.
What magic should I put in flask-script to accomplish this stuff? Is such a thing even possible?