Flame_Phoenix
Flame_Phoenix

Reputation: 17594

Cannot run Hello World on Google App Engine Windows

I have downaloded and installed Python 2.7.6 in my Windows and I have also installed the latest version of the GAE SDK for Windows as well.

I have the following configurations on my GAE: GAE_configs

I am running an Hello World project with the following files:

Main.py

import webapp2

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write('Hello world!')

app = webapp2.WSGIApplication([('/', MainHandler)], debug=True)

app.yaml

application: HelloWorld
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: .*
  script: main.app

libraries:
- name: webapp2
  version: "2.5.2"

However, When I click the button Run, in order to runt he project, I get the following errors in the LOG output:

2013-12-04 14:51:49 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', 'D:\\Users\\pedro\\Desktop\\HelloWorld']"
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 197, in <module>
    _run_file(__file__, globals())
  File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 193, in _run_file
    execfile(script_path, globals_)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 872, in <module>
    main()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 865, in main
    dev_server.start(options)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 657, in start
    options.yaml_files)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\application_configuration.py", line 549, in __init__
    module_configuration = ModuleConfiguration(yaml_path)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\application_configuration.py", line 82, in __init__
    self._yaml_path)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\application_configuration.py", line 266, in _parse_configuration
    return appinfo_includes.ParseAndReturnIncludePaths(f)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\appinfo_includes.py", line 63, in ParseAndReturnIncludePaths
    appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\appinfo.py", line 1756, in LoadSingleAppInfo
    listener.Parse(app_info)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\yaml_listener.py", line 226, in Parse
    self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\yaml_listener.py", line 177, in _HandleEvents
    raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError: Unable to assign value 'HelloWorld' to attribute 'application':
Value 'HelloWorld' for application does not match expression '^(?:(?:[a-z\d\-]{1,100}\~)?(?:(?!\-)[a-z\d\-\.]{1,100}:)?(?!-)[a-z\d\-]{0,99}[a-z\d])$'
  in "D:\Users\pedro\Desktop\HelloWorld\app.yaml", line 1, column 14
2013-12-04 14:51:50 (Process exited with code 1)

Thus I have the following questoins:

  1. I have created this project by going to File -> New application, but apparently my auto-generated app.yaml file is incorrect. What am I doing wrong?
  2. I have tried to use Python 3.3 first, but it was not working. GAE only works with Python 2.7 right? I am doing everythign correctly right?
  3. When I click the Browse button I get the error saying that no browser is specified. How do I fix that?

Thanks for any help if possible :S

Upvotes: 4

Views: 2910

Answers (2)

Leonardo.Z
Leonardo.Z

Reputation: 9801

Your application identifier('HelloWorld') is invalid. You should use the one you created in the Administration Console according to the GAE doc.

The ID will be the subdomain of your GAE application when it deployed in appspot.com. That's why the app id should match the regex r'^(?:(?:[a-z\d\-]{1,100}\~)?(?:(?!\-)[a-z\d\-\.]{1,100}:)?(?!-)[a-z\d\-]{0,99}[a-z\d])$'.

Upvotes: 1

aquavitae
aquavitae

Reputation: 19154

According to the regex that isn't matching, the app name needs to be lowercase:

>>> regex = r'^(?:(?:[a-z\d\-]{1,100}\~)?(?:(?!\-)[a-z\d\-\.]{1,100}:)?(?!-)[a-z\d\-]{0,99}[a-z\d])$'
>>> print(re.match(regex, 'HelloWorld'))
None
>>> print(re.match(regex, 'helloworld'))
<_sre.SRE_Match object at 0x13ac308>

Upvotes: 12

Related Questions