gpt4 book ai didi

javascript - 为什么我无法使用谷歌应用程序引擎获取 Model.all() 形式的数据

转载 作者:行者123 更新时间:2023-11-28 16:36:27 27 4
gpt4 key购买 nike

这是我在 main.py 中的代码

class marker_data(db.Model):
geo_pt = db.GeoPtProperty()
class HomePage(BaseRequestHandler):
def get(self):
a=marker_data()
a.geo_pt=db.GeoPt(-34.397, 150.644)
a.put()
datas=marker_data.all()
self.render_template('3.1.html',{'datas':datas})

在 html 中是:

    {% for i in datas %}
console.log(i)
{% endfor %}

但错误是:

i is not defined

那我能做什么?

谢谢

最佳答案

“i”由服务器端的模板引擎解释,因此您需要:

{% for i in datas %}
console.log({{ i }});
{% endfor %}

关于javascript - 为什么我无法使用谷歌应用程序引擎获取 Model.all() 形式的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3723521/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com