python - Load objects from text files into datastore/ndb using djangoappengine -
i'm trying port existing webapp2 django. i'm using djangoappengine uses django 1.5
previously while using webapp2, used url handler load objects ndb
#webapp2 class migratedata(webapp2.requesthandler): def get(self): listofentities=[] self.loadtagtrend("tagtrend_refine.txt",listofentities) ndb.put_multi(listofentities) def loadtagtrend(self, filename, listofdata): f = open(filename) lines = f.readlines() f.close() line in lines: temp = line.strip().split("\t") data = models.tagtrend_refine( tag = temp[0], trenddata = temp[1] ) listofdata.append(data) return application = webapp2.wsgiapplication([("/migratedata", migratedata),],debug=true)
how perform same thing on django? possible run remote shell instead of using url handler?
to keep simple, wish find method run .py script reading of files , using bulk_create save ndb on both deployed , development server.
Comments
Post a Comment