python flask Mlab js Unicode stange行为

时间:2018-12-07 19:46:50

标签: javascript python mongodb unicode mlab

我正在尝试从mlab.com上托管的mongodb中检索一些数据,并在模板中将此数据用作jinja2变量。

当我尝试console.log时,从烧瓶" char发送的数据字典显示为',而我在字典中找不到键和值。

有人遇到过同样的问题吗?

[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'}]

0 个答案:

没有答案
相关问题