M
M
Michael2015-10-22 13:05:51
Flask
Michael, 2015-10-22 13:05:51

How to transfer data to 1000 views without explicitly transferring them separately in each of them FLASK?

Hello, if 1 or 2 views are rendered in Vlaska, everything is clear here

@app.route('/')
def a():
return render_template(index.html, data = data)

But what if the date variable needs to be passed in different 100 urls? how to pass it implicitly without specifying it in all 100 views?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Tanker John, 2015-10-22
@nextel

You can pass data to the template automatically using Context Processors .

V
Vladimir Abiduev, 2015-10-29
@gunlinux

You can make it a decorator. flask.pocoo.org/docs/0.10/patterns/viewdecorators

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question