J
J
Jekson2019-02-15 10:37:57
Python
Jekson, 2019-02-15 10:37:57

How to pass parameter from response to internal function?

There is an index function in the body of which another loadfunc function imported from a separate project is executed.

from project.myproject import loadfunc

@app.route('/')
def index():
    loadfunc()
    return render_template("result.html")

def loadfunc():
    ....
    ....
    return count

If you just execute index , it will redirect to result.html as expected, I can’t figure out how to display the count parameter in return_render_template. Type
return render_template("result.html", count=count)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pcdesign, 2019-02-15
@Lepilov

from project.myproject import loadfunc

@app.route('/')
def index():
    count = loadfunc()
    return render_template("result.html", count=count)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question