我正在尝试https://github.com/rochacbruno/Flask-GoogleMaps
的代码 在app中:
from flask import Flask, render_template
from flask_googlemaps import GoogleMaps
from flask_googlemaps import Map
app = Flask(__name__, template_folder="templates")
GoogleMaps(app, key='mmm')
@app.route("/")
def mapview():
mymap = Map()
sndmap = Map()
return render_template('example.html', mymap=mymap, sndmap=sndmap)
if __name__ == "__main__":
app.run(debug=True)
模板中的:{{googlemap("my_awesome_map", lat=0.23234234, lng=-0.234234234, markers=[(0.12, -0.45345), ...])}}
与
myproject/
app.py
templates/
examples.html
我收到了这个错误: jinja2.exceptions.TemplateSyntaxError:unexpected'。'
如何解决?
答案 0 :(得分:0)
如果您使用标记,模板应该是这样的:
头上:
{{"decoupled-map"|googlemap_js(37.4419, -122.1419, markers=[(37.4419, -122.1419)])}}
身体:
{{"decoupled-map"|googlemap_html(37.4419, -122.1419)}}