python 2.7 - I am running a bottle.py baesd web service in google app engine.But how can i connect it to GAE database NOSql -


i running webservice in localhost in system. have connected mysql.and working fine. when comes googleappengine how can connect nosql.

this code:

import bottle import webapp2 bottle import route, run, template import mysqldb, mysqldb.cursors bottle import route, template, request ,debug google.appengine.ext.webapp.util import run_wsgi_app db = mysqldb.connect(user="root", passwd="root", db="delhipoc" , host='127.0.0.1') cur = db.cursor()  def main():     debug(true)     run_wsgi_app(bottle.default_app())     @route('/hai/<name>') def show(name):      print "the name \n",name      cur.execute('select * poc_people')      print "i in show \n"      row in cur.fetchall() :         print row[0] data = row[0]             print "hai \n",row[0] return template('<b></br></br></br>hello{{name}}</br></br></br>{{data}}   </b>!',name=name,data=data)  if __name__ == '__main__':     main() 

in above way can connect local mysql database. how can connect gae database.please solve issue.

create datastore model corresponding table , convert mysql api request use datastore api. datastore reference: https://developers.google.com/appengine/docs/python/datastore/ don't need explicitly "connect" gae datastore, can issue query, filter, etc.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -