Migrating web2py to GAE

57 views
Skip to first unread message

Al

unread,
Mar 16, 2010, 8:58:05 AM3/16/10
to web2py-users
Hi,

I have been trying to move myapp from web2py app to GAE without
success. I can manage to deploy web2py to GAE with the three built in
apps (admin, welcome and examples) where I can login to admin and
navigate to each of the three apps, but if I incorporate myapp, when I
navigate to myapp thru the admin interface after deployment, it
generate internal error. (though editing myapp thru admin still OK).
It is not just myapp which has this problem, but when I tried the T3
and C.R.M appliance, it also has similar error. Note: I have changed
the app.yaml in the web2py source to the following:

application: myfirstapp
version: 1
api_version: 1
runtime: python

handlers:
- url: /.*
script: gaehandler.py
secure: always

Further, if I use the original app.yaml in the web2py src, then when
try to go into the admin interface, it will give "invalid request"
error.

Could anyone share how they deploy T3 or CRM into GAE, what changes in
the app.yaml or any other setting is required.

Cheers
Al

Vasile Ermicioi

unread,
Mar 16, 2010, 10:04:51 AM3/16/10
to web...@googlegroups.com
the main limitations that I met on gae are database queries, how do you use them?

mdipierro

unread,
Mar 16, 2010, 11:07:16 AM3/16/10
to web2py-users
Before you deply any app on GAE you need to run it locally first using
dev_appserver. You have to run it locally and make sure you executed
every query in your code at least once. Only then you can deploy it on
GAE. The purpose of this is for GAE to discover which queries you use
and build indexes.

Massimo

Richard

unread,
Mar 16, 2010, 9:04:00 PM3/16/10
to web2py-users
what error do you get exactly? There are many possibilities when
migrating to GAE...

Al

unread,
Mar 17, 2010, 9:57:59 AM3/17/10
to web2py-users
The appadmin can be run on GAE, but it cannot run on local GAE SDK.
(note: I have been thinking it might due to some basic settings, not
just my code, which I have overlooked, as running T3 and C.R.M
appliances have the same problem). I have customised myapp according
to the web2py manual to suit GAE deployment. Also I always got the
same result on both my mac and windows machines

Here is the log on the console:


*** Running dev_appserver with the following flags:
--admin_console_server= --port=8009 --clear_datastore
Python command: /usr/bin/python2.5
WARNING 2010-03-17 13:45:04,091 datastore_file_stub.py:623] Could not
read datastore data from /var/folders/fd/fdhbJFB5Hj8Bou9ORL02zE+++TM/-
Tmp-/dev_appserver.datastore
Traceback (most recent call last):
File "/Users/albertc/Desktop/GoogleAppEngineLauncher.app/Contents/
Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/dev_appserver.py", line 68, in <module>
run_file(__file__, globals())
File "/Users/albertc/Desktop/GoogleAppEngineLauncher.app/Contents/
Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/dev_appserver.py", line 64, in run_file
execfile(script_path, globals_)
File "/Users/albertc/Desktop/GoogleAppEngineLauncher.app/Contents/
Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/google/appengine/tools/dev_appserver_main.py", line
417, in <module>
sys.exit(main(sys.argv))
File "/Users/albertc/Desktop/GoogleAppEngineLauncher.app/Contents/
Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/google/appengine/tools/dev_appserver_main.py", line
394, in main
static_caching=static_caching)
File "/Users/albertc/Desktop/GoogleAppEngineLauncher.app/Contents/
Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/google/appengine/tools/dev_appserver.py", line 3727,
in CreateServer
return HTTPServerWithScheduler((serve_address, port),
handler_class)
File "/Users/albertc/Desktop/GoogleAppEngineLauncher.app/Contents/
Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/google/appengine/tools/dev_appserver.py", line 3741,
in __init__
request_handler_class)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/SocketServer.py", line 330, in __init__
self.server_bind()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/BaseHTTPServer.py", line 101, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/SocketServer.py", line 341, in server_bind
self.socket.bind(self.server_address)
File "<string>", line 1, in bind
socket.error: (48, 'Address already in use')

mdipierro

unread,
Mar 17, 2010, 10:43:04 AM3/17/10
to web2py-users
This is not a web2py issue.

File "<string>", line 1, in bind
socket.error: (48, 'Address already in use')

You have some other server running using the same port.

I just tried appadmin and works file with me.

mat --

unread,
Mar 17, 2010, 11:23:12 AM3/17/10
to web...@googlegroups.com
Hi - can someone (re)explain how to get appadmin running on GAE?
On non-GAE hosting I understand it requires SSH tunnel. But is there an equivalent on GAE? Currently, when accessing appadmin on both local GAE and GAE I get: "Admin is disable because insecure channel". Does the app.yaml file need to be edited?
Thanks!

--
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+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/web2py?hl=en.




--
Mat

mdipierro

unread,
Mar 17, 2010, 12:10:49 PM3/17/10
to web2py-users
replace http://... with https://....

GAE has its own certificate. It works for me at

https://web2py-crm.appspot.com/init/appadmin

> > web2py+un...@googlegroups.com<web2py%2Bunsu...@googlegroups.com>

Thadeus Burgess

unread,
Mar 17, 2010, 12:16:29 PM3/17/10
to web...@googlegroups.com
Does the GAE SSL certificate compatible with google checkout?

The snag with using plugin google checkout level 2 integration is the
need for a $80/year SSL certificate :(

-Thadeus

> To unsubscribe from this group, send email to web2py+un...@googlegroups.com.

Jonathan Lundell

unread,
Mar 17, 2010, 12:19:49 PM3/17/10
to web...@googlegroups.com
On Mar 17, 2010, at 9:10 AM, mdipierro wrote:

> replace http://... with https://....
>
> GAE has its own certificate. It works for me at
>
> https://web2py-crm.appspot.com/init/appadmin

Where's the best approximation of a cookbook approach for running web2py on GAE? I looked at the deployment chapter of the book, and it's very, very sketchy. I couldn't find much on slices or the wiki.

(BTW, the above link left my in a loop asking for my Google password.)

> To unsubscribe from this group, send email to web2py+un...@googlegroups.com.

mdipierro

unread,
Mar 17, 2010, 12:59:51 PM3/17/10
to web2py-users
Because you are not the owner of that app so your google credentials
do not get you in.

If you are the owner of an app, it will work.

There is no cookbook because there is nothing to be done other than:

0) register with gae and get an app_id
1) change the name in app.yaml (first line: replace web2py with your
app_id)
2) run it locally

dev_appserver.py web2py

3) make sure you hit every functionality so indeices are created
4) deploy it

appcfg.py update web2py

Caveats:
Robin pointed our with me that expiration of session cannot be
controlled when stored in memcache because memcache on GAE can be
evicted at any time without our control.

Massimo

mat --

unread,
Mar 17, 2010, 2:36:23 PM3/17/10
to web...@googlegroups.com
I am now able to indeed access appadmin via https :-)
Thank you!

To unsubscribe from this group, send email to web2py+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/web2py?hl=en.




--
Mat

Jonathan Lundell

unread,
Mar 17, 2010, 5:36:23 PM3/17/10
to web...@googlegroups.com
On Mar 17, 2010, at 9:59 AM, mdipierro wrote:

> There is no cookbook because there is nothing to be done other than:
>
> 0) register with gae and get an app_id
> 1) change the name in app.yaml (first line: replace web2py with your
> app_id)
> 2) run it locally
>
> dev_appserver.py web2py
>
> 3) make sure you hit every functionality so indeices are created
> 4) deploy it
>
> appcfg.py update web2py
>
> Caveats:
> Robin pointed our with me that expiration of session cannot be
> controlled when stored in memcache because memcache on GAE can be
> evicted at any time without our control.

See? It's a very short cookbook with one easy recipe.

Seriously, it may be simple, but it's not obvious a priori. It'd be worth collecting this somewhere easy to find.

mdipierro

unread,
Mar 17, 2010, 9:09:15 PM3/17/10
to web2py-users
You are right. I will find a place.

Al

unread,
Mar 18, 2010, 9:34:31 AM3/18/10
to web2py-users
Change the port does get me to the welcome screen on the local GAE,
click into admin interface gives "admin is disabled because insecure
channel"; if I change http to https then it gives me "Secure
Connection Failed: SSL received a record that exceed the max possible
length:

Could some one share what they put in the app.yaml please !!!!

Al

unread,
Mar 18, 2010, 9:42:04 AM3/18/10
to web2py-users
Sorry I forgot to post the console error for the previous message:

*** Running dev_appserver with the following flags:

--admin_console_server= --port=8012
Python command: /usr/bin/python2.5
INFO 2010-03-18 13:30:11,558 dev_appserver_main.py:399] Running
application myownapp on port 8012: http://localhost:8012
WARNING 2010-03-18 13:30:13,749 py_zipimport.py:103] Can't open
zipfile /Library/Python/2.5/site-packages/setuptools-0.6c9-py2.5.egg:
IOError: [Errno 13] file not accessible: '/Library/Python/2.5/site-
packages/setuptools-0.6c9-py2.5.egg'
WARNING 2010-03-18 13:30:13,774 py_zipimport.py:103] Can't open
zipfile /Library/Python/2.5/site-packages/hl7-0.1.0-py2.5.egg:
IOError: [Errno 13] file not accessible: '/Library/Python/2.5/site-
packages/hl7-0.1.0-py2.5.egg'
WARNING 2010-03-18 13:30:14,192 portalocker.py:91] no file locking
WARNING 2010-03-18 13:30:15,415 main.py:50] unable to import
wsgiserver
INFO 2010-03-18 13:30:15,454 gaehandler.py:55] **** Request:
1.83ms/1.83ms (real time/cpu time)
INFO 2010-03-18 13:30:15,502 dev_appserver.py:3246] "GET / HTTP/
1.1" 303 -
INFO 2010-03-18 13:30:15,550 dev_appserver_index.py:205] Updating /
Users/albertc/Documents/GAEapp/web2py/index.yaml
WARNING 2010-03-18 13:30:15,623 py_zipimport.py:103] Can't open
zipfile /Library/Python/2.5/site-packages/setuptools-0.6c9-py2.5.egg:
IOError: [Errno 13] file not accessible: '/Library/Python/2.5/site-
packages/setuptools-0.6c9-py2.5.egg'
WARNING 2010-03-18 13:30:15,649 py_zipimport.py:103] Can't open
zipfile /Library/Python/2.5/site-packages/hl7-0.1.0-py2.5.egg:
IOError: [Errno 13] file not accessible: '/Library/Python/2.5/site-
packages/hl7-0.1.0-py2.5.egg'
INFO 2010-03-18 13:30:15,970 gaehandler.py:55] **** Request:
368.73ms/295.66ms (real time/cpu time)
INFO 2010-03-18 13:30:16,032 dev_appserver.py:3246] "GET /welcome/
default/index HTTP/1.1" 200 -
WARNING 2010-03-18 13:30:20,357 py_zipimport.py:103] Can't open
zipfile /Library/Python/2.5/site-packages/setuptools-0.6c9-py2.5.egg:
IOError: [Errno 13] file not accessible: '/Library/Python/2.5/site-
packages/setuptools-0.6c9-py2.5.egg'
WARNING 2010-03-18 13:30:20,414 py_zipimport.py:103] Can't open
zipfile /Library/Python/2.5/site-packages/hl7-0.1.0-py2.5.egg:
IOError: [Errno 13] file not accessible: '/Library/Python/2.5/site-
packages/hl7-0.1.0-py2.5.egg'
INFO 2010-03-18 13:30:20,814 gaehandler.py:55] **** Request:
477.67ms/333.69ms (real time/cpu time)
INFO 2010-03-18 13:30:20,859 dev_appserver.py:3246] "GET /admin/
default/index HTTP/1.1" 200 -
ERROR 2010-03-18 13:30:30,333 dev_appserver.py:3242] code 400,
message Bad request syntax ("\x16\x03\x01\x00\x9b
\x01\x00\x00\x97\x03\x01K\xa2*\xf6\xc4\x9e9>QaC\xcc\xd8Uk\xe6y
\x87\xf1\x9c\xff\xe6\xab'")

mdipierro

unread,
Mar 18, 2010, 9:44:04 AM3/18/10
to web2py-users
I think I misunderstood what you tried to do:

If you run locally with dev_appserver you can only connect to web2py
from localhost and you can use appadmin over http. You do not need
https

If you deply your apps on GAE you need to use https to access
appadmin.

The fact you run locally and need https make me think you are trying
to access web2py remotely while using dev_appserver or you are using
the wrong IP in the URL (you must use http::/127.0.0.1:<port>).
dev_appserver is not designed for production so I am not surprised
https has problems with it.

Al

unread,
Mar 19, 2010, 7:03:39 AM3/19/10
to web2py-users
Thanks mdipierro. It is indeed the URL causing the problem, as it
defaults to "localhost" rather than "127.0.0.1" when I click the
Browse button after Run. I did not realise the code inside appadmin.py
actually checks for "127.0.0.1". Now I can really troubleshoot
myownapp to make it work on GAE

Al

Reply all
Reply to author
Forward
0 new messages