我试图从mlab.com上托管的mongodb中检索一些数据,并在模板中使用这些数据作为jinja2变量
当我尝试console.log数据dict从flask发送时"
char显示为'
,在dict中找不到键和值
有人有同样的问题吗
[u'
我的珍贵数据'
]而不是['我的珍贵数据']
if not session.get('logged_in'):
return 'Please login'
else:
restaurant = mongo.db.restaurant
restaurantData = list(restaurant.find())
logging_wrap1.debug(restaurantData)
import json
d = json.dumps(restaurantData[0])
logging_wrap1.debug('This is d : %s',d)
return render_template('customer.html', data = d )
前端
console.log('{{data}}')
控制台输出
[{u'description': u'cel mai bun restaurant', u'icon': u'Some img will be saved here', u'location': u'46.5407567,23.8916893', u'_id': u'xxxx', u'open': {u'weekend': u'Closed', u'weekday': u'0800-1800'}, u'name': u'broscuta'}]
目前没有回答
相关问题 更多 >
编程相关推荐