使用dev_server everthin正常工作。从数据存储区保存和检索值。在生产中,什么都无法检索。在仪表板的跟踪中,我可以看到查询已运行,但未返回任何内容。日志中没有错误。
application: my-bottle-app
version: 1
runtime: python27
api_version: 1
threadsafe: true
libraries:
- name: django
version: latest
handlers:
- url: /static
static_dir: static
- url: /.*
script: board.app
bottle.py:
class Scores(db.Model):
player_name = db.StringProperty(required=True)
score = db.IntegerProperty(required=True)
score_date = db.DateTimeProperty(auto_now=True)
@route('/static/<filename>')
def server_static(filename):
return static_file(filename, root='/home/cameron/Projects/Wordster/static')
@post('/')
def enter_score():
data = request.json
name = data['name']
score = data['score']
s = Scores(player_name=name,
score=score)
s.put()
@get('/')
def page():
letters = scorer.get_letter_set()
q = db.GqlQuery('SELECT player_name,score FROM Scores order by score DESC').fetch(5)
return template('board', letters=letters, scores=q, letterset=json.dumps(letters))
@get('/scores')
def scores_view():
q = db.GqlQuery('SELECT player_name,score FROM Scores order by score DESC').fetch(100)
return template('scores', data=q)
run(server='gae')
app=default_app()
答案 0 :(得分:1)
这是一个简单的愚蠢问题,感谢Patrice帮助缩小范围。我所做的就是忘记在我的javascript回调函数中更改url来处理post请求。