python - Why isn't my webapp2 import / Google App Engine "Hello, World" working? -
When I'm running my "Hello, World" program on Google App Engine (GAE), it only works When I make a version that does not rely on WebEp2 import, why is not importing work? What do I need to do to fix this?
The version of Helloworld.py that works:
print 'content-type: text / plain' print '' print 'hello, world !!' The version of the virtual keyboard that is not working:
Import the webapp2 class manpage (webapp2.RequestHandler): def find (auto): self .response '[Content-type'] = 'text / plain' self.response.out.write ('hello, world!') App = webapp2.WSGIApplication (([/ ',' manpage]], debug = true) This second version presents an empty page.
I think the problem is that webapp2 import is not working when I have a directory inside Python I get the following from the command line as my hello world program:
Brians-MacBook-Air-2: app_engine_hello_world brian $ python Python 2.7.2 (V2.7.2: 8527427914) A2, 11, 2011, 15:22:34) For more information on Darwin (GCC 4.2.1 (Apple Inc.'s build 5666) (dot 3)] type "help", "copyright", "credit" or "license". & Gt; Import webpage 2 traceback (the most recent call final): The file does not have any module named "& lt; stdin", line 1, & lt; module & gt; ImportError: webapp2
However, I see webapp2.py in the following directory:
Brian-MacBook-Air-2: webapp2 brian $ Besides, I have Python 2.7 Low station Installing on: Brians- / pwd / users / brian / repos / app_engine_hello_world / build / webapp2 MacBook-Air-2 : Ap_Agin_Hello_World Bryan $ Joe Dragon / Library / Frames / Python.Framework / Version2.7 / bin / python
EDIT: My App. Yaml file & amp; Some other potentially useful information ...
Application: Hello-world-cs 253 version: 1 runtime: Python 27 API_version: 1 threadsof: no handler: - url: /.cript script: Helloworld.py I am using version 1.7.0 - 2012-06-26 of SDK / GAE Launcher
Result in Chrome, Firefox, and Safari
You do not need to install webapp2 when you run dev_appserver.py on your project direct Runs in the form of logic with the path of R, it handles the import of webapp2 . Do you have an app? Here's the place, and is this right?
For Python2.7 you must specify that you are using Python2.7. Runtime should have Python 27
Application: your_app version: 1 runtime: Python 27 # Important API_version: 1 thread: correct handler: - url: /.* script: your_app.py What are you running to run your program?
Do this -
On your computer: ~ / GAE_folder $ python dev_appserver.py / Edit I think that I know what the problem is. It happened to me when I first tried the example given on the site.
Add this code to your helloworld.py file at the end - def main (): app.run () if __name__ == '__ main__': main ()
Comments
Post a Comment