我正在尝试将现有的webapp2移植到django。我使用的是djangoappengine,它使用django1.5
以前在使用webapp2时,我使用URL处理程序将对象加载到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()
for 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)
我如何在django上执行相同的操作?是否可以从远程shell运行而不是使用url处理程序?你知道吗
为了简单起见,我希望找到一种方法来运行一个.py脚本,该脚本读取文件并使用bulk\u create保存到部署服务器和开发服务器上的ndb中。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐