Python 应用程序引擎数据存储赢得';t保存LatLng(谷歌地图)值

Python 应用程序引擎数据存储赢得';t保存LatLng(谷歌地图)值,python,google-app-engine,google-cloud-datastore,geocode,Python,Google App Engine,Google Cloud Datastore,Geocode,我的网站(服务器端有python/django)接收用户输入的Latlng(Google Maps API 2)地理代码,并将其存储到Google Appengine数据存储中或从中检索 c = myplace.MyPlace( geo_point = latlng, c.put() 其中,数据库模型定义如下: from google.appengine.ext import db class Myplace(db.Model):

我的网站(服务器端有python/django)接收用户输入的Latlng(Google Maps API 2)地理代码,并将其存储到Google Appengine数据存储中或从中检索

        c = myplace.MyPlace(
            geo_point = latlng,
        c.put()
其中,数据库模型定义如下:

from google.appengine.ext import db

class Myplace(db.Model):
    geo_point   = db.GeoPtProperty()
问题是,当我保存任何
地理编码(例如8.928487062665504、105.062255859375)
时,检索到的总是
37.4229181,-122.0854212
,这是谷歌山景城的位置。 在此过程中没有错误消息

你能告诉我为什么会这样吗


ShopInfo.py

def新建(需要):
如果req.method==“POST”:
尝试:
u_表单=购物信息表单(请求发布)
如果不是u形式,则为有效()
返回错误页面('无效的输入值')
#地理点
latlng=无
如果请求POST.get('geo_点'):
latlng=请求POST.get('geo_点').strip()
latlng=字符串。替换(latlng,“”(“”,“”)
latlng=字符串。替换(latlng“)”,“”)
c=myplace.myplace(所有者=u,
昵称=美国昵称,
#title=unicode(请求POST['title'].strip(),'utf8'),
#content=unicode(请求POST['content'].strip(),'utf8'),
title=req.POST['title'].strip(),
content=req.POST['content'].strip(),
geo_点=车床,
post_time=datetime.now())
c、 写在这里
返回HttpResponseRedirect('/shop/'+str(c.key().id())+'/read/'))
除例外情况外,x:
返回错误页面(“错误”)
返回错误页面(“错误请求”)
def读取(需求、车间id):
如果req.method==“GET”:
user\u info=users.get\u current\u user()
s=myplace.myplace.get\u by\u id(int(shop\u id))
如果不是,则:
返回错误页面(“错误请求”)
上下文={'static_path':static_path,
“用户信息”:用户信息,
“商店”:在这里阅读
返回render\u to\u响应('shop\u read.html',上下文)
返回错误页面(“错误请求”)
**shop_read.html**
{%if shop.geo_point%}
load(“jquery”,“1”);

能否包含用于1)初始化
Myplace
实例的代码,2)保存实例,3)检索实例的代码。我添加了一些用于初始化、保存和检索的代码。谢谢你的帮助。问题神秘地消失了,现在正确的坐标被保存和检索。谢谢你。你能不能把这个或什么东西关上,这样它就不会显示为未答复?
def new(req):                       
   if req.method == 'POST':
        try:
            u_form = ShopInfoForm(req.POST)
            if not u_form.is_valid():
                return err_page('Invalid input values.')

            # geo_point
            latlng = None
            if req.POST.get('geo_point'):
                latlng = req.POST.get('geo_point').strip()
                latlng = string.replace(latlng, '(', '')
                latlng = string.replace(latlng, ')', '')

            c = myplace.MyPlace(owner = u,
                    nickname = u.nickname,
                    #title = unicode(req.POST['title'].strip(), 'utf8'),
                    #content = unicode(req.POST['content'].strip(), 'utf8'),
                    title = req.POST['title'].strip(),
                    content = req.POST['content'].strip(),
                    geo_point = latlng,
                    post_time = datetime.now())
            c.put()                  ##WRITE HERE

            return HttpResponseRedirect('/shop/'+str(c.key().id())+'/read/')
        except Exception, x:
            return err_page('Error.')
    return err_page('Wrong request')

def read(req, shop_id):         
    if req.method == 'GET':
        user_info = users.get_current_user()
        s = myplace.MyPlace.get_by_id(int(shop_id))  
        if not s:
            return err_page('Wrong request')

        context = {'static_path': STATIC_PATH,
                   'user_info': user_info,
                   'shop' : s}            ##READ HERE
        return render_to_response('shop_read.html', context)
    return err_page('Wrong request')

**shop_read.html**

    {% if shop.geo_point %}
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=" type="text/javascript"></script>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("jquery", "1");</script>
<script type="text/javascript">