kennysong
kennysong

Reputation: 2134

Google App Engine app.yaml URL Mapping

So a part of the app.yaml file looks like the following (on the GAE tutorial at least):

handlers:
- url: /.*
  script: main.app

However, I've also seen it look like this:

handlers:
- url: /*
  script: main.py

Is the second one wrong? Why is the "." necessary and what does it notate? And why does the script end in ".app" when it is clearly a ".py" file?

Upvotes: 2

Views: 558

Answers (2)

Chris Lam
Chris Lam

Reputation: 43

.app is not the file extension! main.app means the app object from main.py; the app object must be a WSGIApplication object

main.py:

import webapp

def HwHandler(webapp.RequestHandler):
   def get(self):
       self.response.out.write('Hello world')

appvar = webapp.WSGIApplication([('/', HwHandler)],debug = True)

app.yaml:

handlers:
- url: .*
  script: main.appvar

Upvotes: 3

dragonx
dragonx

Reputation: 15143

.* is a regexp that matches everything. Do a google search on regular expressions. main.app is the notation for the wsgi apps for python 2.7.

main.py is probably for a python 2.5 app.

Upvotes: 1

Related Questions