Answer the question
In order to leave comments, you need to log in
How to put functions in a separate file?
I understand that it is possible to make a helper.py file
# helper.py
def bar():
return 'Hi'
from helper import bar
@app.route("/")
def index():
bar = bar()
get trans(key):
return redis_store.get('en_transcr:' + key)
redis_store = FlaskRedis(app)
Answer the question
In order to leave comments, you need to log in
from Flask as flask
get trans(key):
redis_store = flask.g.redis
return redis_store.get('en_transcr:' + key)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question