在我的 Google App Engine 应用中,我收到了错误
ImportError:没有名为 main 的模块
访问 URL 时/foo
。我的应用程序中的所有文件都在父目录中。
这是我的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"
这是我的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()
当我更改main.application
为main.py
or时,我得到了同样的错误main
。为什么会出现这个错误?