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

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -