I’m using Python 2.7 in Google App Engine and can’t seem to get my app.yaml file set up right.
My goal is so that if I go to http://localhost/carlos/ I get an executed carlos.py
Here is my directory structure:
app\
\app.yaml
\main.py
\carlos.py
Here is my current app.yaml file:
application: myapp
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /carlos/.*
script: carlos.app
- url: .*
script: main.app
and my carlos.py file is:
import webapp2
class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.out.write("Hello, Carlos!")
app = webapp2.WSGIApplication([('/carlos', MainHandler)],
debug=True)
However all I’m getting now is a 404 Not Found error. Any thoughts?
I was able to determine the solution and figured I’d post it for anyone out there.
In my carlos.py file I needed to replace:
with
It appears that the first argument for the WSGIApplication is referring to the TOTAL path from your root web address as opposed to the INCREMENTAL path from which it was originally directed.
I’m selecting this answer over what was provided by Littm because I’d like to keep using WSGI