乳寧這個代碼後,我發現導入錯誤: -蟒蛇導入錯誤「無模塊命名appengine.ext」
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
application = webapp.WSGIApplication([('/', MainPage)],debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
如何使用google.apengine.ext
你是如何安裝它的?檢查它是否在你的PYTHONPATH上。 – StoryTeller
如果您試圖在交互式Python環境中運行它,您將不得不修改sys.path,如下面的註釋中所述。如果您打算提供Web應用程序,那麼您應該使用dev_appserver.py運行您的應用程序。命令將是 /platform/google_appengine/dev_appserver.py app.yaml –
我不知道你爲什麼刪除了我的答案。我有完全相同的錯誤,並有文件google.py導致這個問題。所以對我來說就是答案。可能不是你的確切案例的答案,但它是我的情況的答案。還有,我的錯誤信息完全一樣:「python import error」沒有名爲appengine.ext的模塊「,所以請將我的答案返回給我。 – makkasi