mercredi 8 novembre 2017

Dynamic navbar throughout Flask App [duplicate]

This question already has an answer here:

I'm working on making the navigation of my Flask app work and be efficient. I currently have to pass all of my data throughout every page to allow it to work.

Here's my app.py:

cards = r.json()
@app.route('/')
def index():
return render_template('index.html', cards=cards, badSets=badSets)

cards is holding the data that I get from an API call.

Here's my layout.html:



To make this layout work throughout my site, I must pass the cards items to each page, something that isn't necessary, and that I would like to avoid.




Aucun commentaire:

Enregistrer un commentaire