In my Google App Engine app, I'm getting the error
ImportError: No module named main
when going to the URL /foo
. All the files in my app are in the parent directory.
Here is my app.yaml
:
application: foobar
version: 1
runtime: python27
api_version: 1
threadsafe: no
handlers:
- url: /foo.*
script: main.application
- url: /
static_files: index.html
- url: /(.*\.(html|css|js|gif|jpg|png|ico))
static_files: \1
upload: .*
expiration: "1d"
Here is my main.py
:
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
class Handler(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello world!')
def main():
application = webapp.WSGIApplication([('/foo', Handler)],
debug=False)
util.run_wsgi_app(application)
if __name__ == '__main__':
main()
I get the same error when I change main.application
to main.py
or just main
. Why is this error occurring?