【发布时间】:2013-06-23 23:33:39
【问题描述】:
在我的 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 或只是main 时,我得到了同样的错误。为什么会出现这个错误?
【问题讨论】:
标签: python google-app-engine importerror