Hi, first: Thank you for creating web2py, I am starting to love it :-) I tried an app with a smartgrid on gae, some questions came up:
1.) How can I make the search in smartgrid work on gae (Google App Engine)? I only get the message "query not supported" 2.) Why does the upload for a picture file does *not* work on my mac, but it does on my iPad? Why does it depend from the OS used? On the Mac it seems to upload, 100 % for the uplaod is reached, but in the end I am getting the message: "Error: Server ErrorThe server encountered an error and could not complete your request. If the problem persists, please report<http://code.google.com/appengine/community.html> your problem and mention this error message and the query that caused it." The link for "report" links to https://developers.google.com/appengine/community?hl=de&csw=1 Unfortunately I do not have a ticket, that leeds to question3: 3.) What do I have to configure, that the ticketing system works on gae? That tickets are created and saved in db(gae)? Is it possible that I have to create one ticket locally, that the index is created?? 4.) How can I enable debug on gae? Is there something wrong to take "admin" out of the excludes in the app.yaml? ( for developement :-) ) 5.) How can I make the generic views work on gae? See code below and attached, I used for testing BTW you have to move "gaehandler.py" from folder "handlers" one up (into folder web2py). Put the app.yaml on same level (in folder web2py), remember to set *your* app_spot_ID in Line 6 The path in the gae launcher have to be set to the used web2py (source!) folder. I used the source of web2py (2.6.3-stable+timestamp.2013.09.15.17.01.20 (Running on Rocket 1.2.6, Python 2.7.2), with GoogleAppEngineLauncher 1.8.4.1050 on MacOS 10.8.5 Thank you for help! Cheers! pd Here is what I tested, something very similar to the examples/database_examples (#29,#34): Here is the model: ---------------------------------------------, see example #29, see attached db.py db.define_table( 'person', Field('name'), Field('email'), format = '%(name)s') # ONE (person) TO MANY (products) db.define_table( 'product', Field('seller_id',db.person), Field('name'), Field('description', 'text'), Field('picture', 'upload', default=''), format = '%(name)s') # MANY (persons) TO MANY (purchases) db.define_table( 'purchase', Field('buyer_id', db.person), Field('product_id', db.product), Field('quantity', 'integer'), format = '%(quantity)s %(product_id)s -> %(buyer_id)s') purchased = (db.person.id==db.purchase.buyer_id)&(db.product.id==db.purchase.product_id) db.person.name.requires = IS_NOT_EMPTY() db.person.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, 'person.email')] db.product.name.requires = IS_NOT_EMPTY() db.purchase.quantity.requires = IS_INT_IN_RANGE(0, 10) Here is the controller: ------------------------------------------------------ see example #34, see attached database_examples.py def manage_transactions(): grid = SQLFORM.smartgrid(db.person,linked_tables=['product','purchase'], user_signature=False) return dict(grid=grid) Here is the view:---------------------------------------------------------- this was not part of the examples, but I have to add it, as the generic view used otherwise does not work on gae {{extend 'layout.html'}} <h1>Manage Trancations</h1> <p>{{=grid}}</p> Here is the app.yaml:--------------------------------- # For Google App Engine deployment, copy this file to app.yaml # and edit as required # See http://code.google.com/appengine/docs/python/config/appconfig.html # and http://web2py.com/book/default/chapter/11?search=app.yaml application: PUT_YOUR_APPSPOT_ID_HERE version: 1 api_version: 1 # use this line for Python 2.5 # #runtime: python # use these lines for Python 2.7 # upload app with: appcfg.py update web2py (where 'web2py' is web2py's root directory) # runtime: python27 threadsafe: true # true for WSGI & concurrent requests (Python 2.7 only) default_expiration: "24h" # for static files handlers: # Warning! Static mapping - below - isn't compatible with # the parametric router's language logic. # You cannot use them together. - url: /(.+?)/static/_\d.\d.\d\/(.+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional expiration: "365d" - url: /(.+?)/static/(.+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional - url: /favicon.ico static_files: applications/welcome/static/favicon.ico upload: applications/welcome/static/favicon.ico - url: /robots.txt static_files: applications/welcome/static/robots.txt upload: applications/welcome/static/robots.txt - url: .* #script: gaehandler.py # CGI script: gaehandler.wsgiapp # WSGI (Python 2.7 only) secure: optional admin_console: pages: - name: Appstats url: /_ah/stats skip_files: | ^(.*/)?( (app\.yaml)| (app\.yml)| (index\.yaml)| (index\.yml)| (#.*#)| (.*~)| (.*\.py[co])| (.*/RCS/.*)| (\..*)| #(applications/(BookCode|admin|examples)/.*)| #((admin|examples|welcome)\.(w2p|tar))| #(applications/.*?/(cron|databases|errors|cache|sessions)/.*)| ((logs|scripts)/.*)| (anyserver\.py)| (web2py\.py)| ((cgi|fcgi|modpython|wsgi)handler\.py)| (epydoc\.(conf|css))| (httpserver\.log)| (logging\.example\.conf)| (route[rs]\.example\.py)| (setup_(app|exe)\.py)| (splashlogo\.gif)| (parameters_\d+\.py)| (options_std.py)| (gluon/tests/.*)| (gluon/(rocket|winservice)\.py)| (contrib/(gateways|markdown|memcache|pymysql)/.*)| (contrib/(populate|taskbar_widget)\.py)| (google_appengine/.*)| (.*\.(bak|orig))| )$ builtins: - remote_api: on - appstats: on - admin_redirect: on - deferred: on -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.{{extend 'layout.html'}}
Manage Trancations
{{=grid}}
app.yaml
Description: Binary data
def manage_transactions():
grid = SQLFORM.smartgrid(db.person,linked_tables=['product','purchase'],
user_signature=False)
return dict(grid=grid)
# -*- coding: utf-8 -*-
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#########################################################################
## if SSL/HTTPS is properly configured and you want all HTTP requests to
## be redirected to HTTPS, uncomment the line below:
# request.requires_https()
if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
else:
## connect to Google BigTable (optional 'google:datastore://namespace')
db = DAL('google:datastore')
## store sessions and tickets there
session.connect(request, response, db=db)
## or store session in Memcache, Redis, etc.
## from gluon.contrib.memdb import MEMDB
## from google.appengine.api.memcache import Client
## session.connect(request, response, db = MEMDB(Client()))
## by default give a view/generic.extension to all actions from localhost
## none otherwise. a pattern can be 'controller/function.extension'
response.generic_patterns = ['*'] if request.is_local else []
## (optional) optimize handling of static files
# response.optimize_css = 'concat,minify,inline'
# response.optimize_js = 'concat,minify,inline'
#########################################################################
## Here is sample code if you need for
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - old style crud actions
## (more options discussed in gluon/tools.py)
#########################################################################
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db)
crud, service, plugins = Crud(db), Service(), PluginManager()
## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)
## configure email
mail = auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = '[email protected]'
mail.settings.login = 'username:password'
## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in private/janrain.key
from gluon.contrib.login_methods.rpx_account import use_janrain
use_janrain(auth, filename='private/janrain.key')
#########################################################################
## Define your tables below (or better in another model file) for example
##
## >>> db.define_table('mytable',Field('myfield','string'))
##
## Fields can be 'string','text','password','integer','double','boolean'
## 'date','time','datetime','blob','upload', 'reference TABLENAME'
## There is an implicit 'id integer autoincrement' field
## Consult manual for more options, validators, etc.
##
## More API examples for controllers:
##
## >>> db.mytable.insert(myfield='value')
## >>> rows=db(db.mytable.myfield=='value').select(db.mytable.ALL)
## >>> for row in rows: print row.id, row.myfield
#########################################################################
## after defining tables, uncomment below to enable auditing
# auth.enable_record_versioning(db)
db.define_table(
'person',
Field('name'),
Field('email'),
format = '%(name)s')
# ONE (person) TO MANY (products)
db.define_table(
'product',
Field('seller_id',db.person),
Field('name'),
Field('description', 'text'),
Field('picture', 'upload', default=''),
format = '%(name)s')
# MANY (persons) TO MANY (purchases)
db.define_table(
'purchase',
Field('buyer_id', db.person),
Field('product_id', db.product),
Field('quantity', 'integer'),
format = '%(quantity)s %(product_id)s -> %(buyer_id)s')
purchased = (db.person.id==db.purchase.buyer_id)&(db.product.id==db.purchase.product_id)
db.person.name.requires = IS_NOT_EMPTY()
db.person.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, 'person.email')]
db.product.name.requires = IS_NOT_EMPTY()
db.purchase.quantity.requires = IS_INT_IN_RANGE(0, 10)

