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

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

nginx - phpPgAdmin - log in works but I have to login again after clicking on any links -