Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 2.7.2 and Google App Engine SDK 1.6.1 on Win 7 Home Premium not working

I have installed Python 2.7.2 (Win7 32-bit) and Google App Engine SDK 1.6.1 for Win7 on a 64-bit system running Win7 Home Premium. Default folder locations for both Python and GAE. When I try to run the helloworld project as described in the Google Python Getting Started doc, the Launcher's "browse" button never becomes active. The GAE SDK is supposed to do fine with Python 2.7.

Is there a complete listing anywhere of environment variables needed for this setup to work? So far, all posts I have seen are from users who have gotten well past this absolutely basic step.

like image 521
steve eklund Avatar asked Dec 23 '11 23:12

steve eklund


3 Answers

The Google docs for setting up GAE with Python 2.7 have some issues. If you are trying to launch the basic "hello world" app through the GUI App Engine interface, after following the instructions, you are probably seeing red text and all the buttons are grayed out?

If so, it is because there are errors within your helloworld.py program - this is where the Google instructions failed.

The import statement they have in the instructions:

import webapp2

This fails, it needs to point to the local instance of GAE's webapp. Also, their Python 2.7 program is incomplete. If you look at the Python 2.5 example, you will see the complete program (you may need to modify webapp --> webapp2 for Python 2.7?):

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Hello, webapp World!')

application = webapp.WSGIApplication(
                                     [('/', MainPage)],
                                     debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()

Last thing, the YAML file in the Google instructions refer to "helloworld.app" - I can't confirm this, but I think it needs to be "helloworld.py" ?? I don't know, I may be wrong.

A couple months have gone by since you posted the question, if you found out any details, please feel free to update this question.

like image 164
brandtrock Avatar answered Sep 21 '22 12:09

brandtrock


I was facing the same issue, browse button was disabled. I ran dev_appserver.py helloworld command at command prompt and then opened localhost:8080 in my browser the hello world program ran successfully.

like image 31
Arif Avatar answered Sep 21 '22 12:09

Arif


I compared the helloworld example to the guestbook demo and found that the application element was key. I added the line at the top of the app.yaml file "application: helloworld" and the helloworld example started working in the Google App Engine (GAE). Note that the 'application' element is supposed to be optional as defined in the app.yaml reference. It looks like it is optional if you use the command line, and it is not optional if you use GAE.

like image 29
Gavin Palmer Avatar answered Sep 23 '22 12:09

Gavin Palmer