我正在使用web.py和GAE(Windows 7,Python27)运行一些基本的测试代码.该表单允许将消息发布到数据存储区.当我停止应用并再次运行时,之前发布的任何数据都已消失.使用admin手动添加实体(http:// localhost:8080/_ah/admin/datastore)也存在同样的问题.
我尝试使用额外标志在应用程序设置中设置路径:
--datastore_path=D:/path/to/app/
Run Code Online (Sandbox Code Playgroud)
(不确定那里的语法).它没有效果.我搜索了我的计算机上的*.datastore,并且找不到任何文件,这似乎是可疑的,尽管数据显然是在应用程序运行期间存储在某处.
from google.appengine.ext import db
import web
urls = (
'/', 'index',
'/note', 'note',
'/crash', 'crash'
)
render = web.template.render('templates/')
class Note(db.Model):
content = db.StringProperty(multiline=True)
date = db.DateTimeProperty(auto_now_add=True)
class index:
def GET(self):
notes = db.GqlQuery("SELECT * FROM Note ORDER BY date DESC LIMIT 10")
return render.index(notes)
class note:
def POST(self):
i = web.input('content')
note = Note()
note.content = i.content
note.put()
return web.seeother('/')
class crash:
def GET(self):
import logging
logging.error('test')
crash
app = web.application(urls, globals())
def …Run Code Online (Sandbox Code Playgroud) google-app-engine persistence python-2.7 google-cloud-datastore