python - Display json along with html template in flask -


how return json along html template below in flask?.

@app.route('/test') def test():     = {     "test1": flag,     "test2": flag }     return '''        <body>        ...        </body>        ''' 

@app.route('/test') def test():     = {     "test1": flag,     "test2": flag }     b = jsonify(a)     render_template("index.html",**locals()) 

in html file, can call a,b etc..

{{b}}

{{a}}


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -