I managed to call in a JSON file into my router and access the content in the template. However, I’m wondering if there’s a simpler way of calling my data. Is there a way to just call
for example, and not
? Any help would be greatly appreciated.
@app.route('/article-02/welcome') def article_02_welcome(): with app.open_resource("templates/article-02/data.json", "r" ) as data_file: data = json.load(data_file) return render_template("article-02/welcome.html", data = data)
<h1></h1> <div class="overline">Category: </div>