Tracked it down.  It seems obvious now, but GAE doesn't seem to create
the table until it has to.  I added this line:

db.define_table('prime1',Field('value','integer'))

and re-ran the application on both web2py and GAE.  In web2py, it
created the file while in GAE it required the following db insert to
create the table:

if len(db(db.prime1.id>0).select())==0:
    db.prime1.insert(value=2)

Your comments forced me to delete the db to test.  That sparked the
thought that the file needed to be forced to create.  Thanks for the
help.
Gary




On Dec 4, 12:58 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Please change
>
>    db().select(db.prime.id)
>
> with
>
>    db(db.prime.id>0).select()
>
> On Dec 4, 11:48 am, Gary <gary.k.ma...@gmail.com> wrote:
>
> > I've been trying to deploy an application to GAE and I'm confused by
> > the fact that it created the 'administration' files like auth_user,
> > but didn't create the files for the application.  I've even taken the
> > prime number paging program from the web2py manual and, although it
> > works on localhost, it fails in local dev GAE.
>
> > Here's the log from local GAE:
>
> > ========== Start Log ===================
>
> > 2009-12-04 12:36:52 PM Running command: "['/usr/bin/python2.5', '/home/
> > gkm/google_appengine/dev_appserver.py', '--admin_console_server=', '--
> > port=8080', '/home/gkm/google_appengine/web2py']"
> > INFO     2009-12-04 17:36:53,877 dev_appserver_main.py:478] Running
> > application verizonpal on port 8080:http://localhost:8080
> > WARNING  2009-12-04 17:37:03,879 portalocker.py:91] no file locking
> > WARNING  2009-12-04 17:37:04,391 cache.py:36] unable to import dbhash
> > WARNING  2009-12-04 17:37:04,532 main.py:57] unable to import
> > wsgiserver
> > INFO     2009-12-04 17:37:04,543 gaehandler.py:56] **** Request:
> > 0.84ms/0.00ms (real time/cpu time)
> > INFO     2009-12-04 17:37:04,551 dev_appserver.py:3178] "GET /prime
> > HTTP/1.1" 400 -
> > INFO     2009-12-04 17:37:04,558 dev_appserver_index.py:205] Updating /
> > home/gkm/google_appengine/web2py/index.yaml
> > ERROR    2009-12-04 17:37:32,786 restricted.py:58] In FILE: /home/gkm/
> > google_appengine/web2py/applications/primes/models/db.py
>
> > Traceback (most recent call last):
> >   File "/home/gkm/google_appengine/web2py/gluon/restricted.py", line
> > 184, in restricted
> >     exec ccode in environment
> >   File "/home/gkm/google_appengine/web2py/applications/primes/models/
> > db.py", line 71, in <module>
> >     if len(db().select(db.prime.id))==0:
> >   File "/home/gkm/google_appengine/web2py/gluon/contrib/gql.py", line
> > 666, in select
> >     (items, tablename, fields) = self._select(*fields, **attributes)
> >   File "/home/gkm/google_appengine/web2py/gluon/contrib/gql.py", line
> > 611, in _select
> >     table = self._get_table_or_raise()
> >   File "/home/gkm/google_appengine/web2py/gluon/contrib/gql.py", line
> > 590, in _get_table_or_raise
> >     raise SyntaxError, 'Set: no tables selected'
> > SyntaxError: Set: no tables selected
>
> > INFO     2009-12-04 17:37:32,787 gaehandler.py:56] **** Request:
> > 194.54ms/150.00ms (real time/cpu time)
> > INFO     2009-12-04 17:37:32,794 dev_appserver.py:3178] "GET /primes
> > HTTP/1.1" 500 -
>
> > INFO     2009-12-04 17:14:58,695 gaehandler.py:56] **** Request:
> > 63.15ms/60.00ms (real time/cpu time)
> > INFO     2009-12-04 17:14:58,702 dev_appserver.py:3178] "GET /primes
> > HTTP/1.1" 500 -
> > INFO     2009-12-04 17:14:58,706 dev_appserver_index.py:205] Updating /
> > home/gkm/google_appengine/web2py/index.yaml
>
> > ========== End Log =================
>
> > I tried to read the code, but it's over my head.  I'd guess that it
> > has something to do with GAE unsupported functions, but this:
>
> > ======== Custom part of db.py ===========
>
> > db.define_table('prime',Field('value','integer'))
>
> > def isprime(p):
> >     for i in range(2,p):
> >         if p%i==0: return False
> >     return True
>
> > if len(db().select(db.prime.id))==0:
> >     p=2
> >     for i in range(1000):
> >         while not isprime(p): p+=1
> >         db.prime.insert(value=p)
> >         p+=1
>
> > ======== End ========
>
> > is the only custom code in db.py - directly from the manual.
>
> > Should web2py create the data files?  If not, how do they get created?
>
> > Thanks,
> > Gary

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to