web2py runs without tweaks on the Google App Engine, including most of the ORM API, but there are a few observations.
* get the version in trunk *
There is already an app.yaml, you just need to edit it to change the name of the app which defaults to web2py
Instead of
db=SQLDB(....)
you need to use
from gluon.contrib.gq import GQLDB
db=GQLDB()
session.connect(request,response,db=db)
the first two lines tell web2py use bigtable and the last line tells web2py to store sessions in there.
You can use the native google API for use authentication but we suggest that use do something like
try:
from google.appengine.api import users
except:
# user some other form of authentication and store the user's email in
# session.user_email and name in session.user_name
# for example use http://mdp.cti.depaul.edu/cas
else:
user = users.get_current_user()
if user: session.user_email,session.user_name=user.email(),user.nickname()
else: session.user_email,session.user_name=None,None
and you only use session.useremail and session.username in the rest of the code. This will ensure portability outside GAE.
In order to insure portability, db.UserProperty is not supported in web2py. It would make your web2py not portable to systems other than the GAE. What you should do is make a
SQLField('user',requires=IS_EMAIL())
instead. This would make your model portable. Moreover the value of the field would be clearly represented as an email. You can then use these API to convert back and forth between the email representation and the Google User object.
Complex queries do not work, including all type of JOINs, NOT, OR, IN (belongs) and LIKE.
IS_NOT_IN_DB
does not work
IS_IN_DB
may or may not work depending on the complexity of the arguments
File upload does not work because needs a file buffer to allow streaming in.
Normally web2py executes each request in its own transaction, commits on response or rolls back on exception. This transaction safety is supported on the GAE. To quote their docs "The datastore imposes several restrictions on what can be done inside a single transaction". In fact they provide transactions only on a single object so we did not bother to support it.
cache.ram
works only within the same request
cache.disk
does not work because GAE does not support writing on the filesystem.
Tickets are not saved for the same reason above but they should be logged by the GAE.
If you create admin/models/0.py and write in it:
from gluon.contrib.gq import GQLDB
db=GQLDB()
session.connect(request,response,db=db)
then admin will work on the GAE but in read only mode because the GAE does now allow writing on the filesystem.