How to effectively implement sessions in GAE?

后端 未结 3 1146
无人共我
无人共我 2020-12-31 10:05

I was wondering about implementing my own sessions (more for an exercise than anything else) for a GAE app I\'m working ... at first I was thinking of using the datastore to

相关标签:
3条回答
  • 2020-12-31 10:41

    UPDATE - 21 Mar 2011

    At the time of this answer app-engine-patch is discontinued and gaeutilities offer worst features than gae-sessions.

    • GitHub gae-sessions
    • HowTo 10-steps tutorials
    0 讨论(0)
  • 2020-12-31 10:48

    I suggest checking out (and contributing to) these three implementations of appengine sessions before rolling out your own:

    • app-engine-patch
    • gaeutilities
    • gae-session

    Your options look fine but choosing between them probably depends on the size of the session data in your application.

    0 讨论(0)
  • 2020-12-31 10:55

    If you use web2py (version 1.46 or latter) sessions are on by default on GAE. This achieved by the following three lines of web2py code at the top of the scaffoling model:

    from gluon.contrib.gql import *
    db=GQLDB()
    session.connect(request,response,db=db)
    

    Here is a sample action that counts:

    def index():
        session.c=session.c+1 if session.c else 1
        return dict(counter=session.c)
    
    0 讨论(0)
提交回复
热议问题