简体   繁体   中英

GAE datastore performs normally in dev_server, not in production

With dev_server everthin works normally. Values are saved and retrieved from the datastore. In production, nothing can be retrieved. In the traces in the dashboard, I can see the queries were run, but nothing was returned. There are no errors in the logs.

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()

It was a simple stupid problem, thanks to Patrice for helping narrow it down. All I did was forget to change the url in my javascript callback function handling the post request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM