2
我遇到了Webapp2的问题。当我把处理程序指向不同的Python文件在app.yaml中我得到以下错误的网址:在多个文件中使用GAE Webapp2
ERROR 2012-10-06 16:44:57,759 wsgi.py:203]
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 195, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 250, in _LoadHandler
__import__(cumulative_path)
ImportError: No module named application
我的app.yaml:
application: [[app's name]]
version: 1
runtime: python27
api_version: 1
threadsafe: yes
inbound_services:
- mail
handlers:
- url: /send
script: email.application
- url: /_ah/mail/[email protected]*
script: email.application
- url: /.*
script: SDSUmodels.application
libraries:
- name: webapp2
version: "2.5.1"
SDSUmodels.py结尾:
application = webapp2.WSGIApplication([('/request', Request_update),
('/send', Send_report),
(Receive_email.mapping())],
debug=True)`
:
application = webapp2.WSGIApplication([('/info', MakeBasicInfo)],
debug=True)`
和email.py结尾
当我删除这些行
- url: /send
script: email.application
从app.yaml中,错误停止,但是这让我没有办法向特定文件指向的URL。
我可以看到在this question中处理这个问题的一些替代方法,但我想知道为什么这种方法不起作用。我之前在旧版的webapp版本中完成了这项工作,并且已经开始工作 - 详情如下。
app.yaml中:
application: [[other app's name]]
version: 1
runtime: python
api_version: 1
handlers:
- url: /stylesheets
static_dir: stylesheets
- url: /twitter
script: twitter.py
- url: /_ah/mail/[email protected]*
script: kindle.py
- url: /.*
script: web.py
inbound_services:
- mail
twitter.py结尾为:
application = webapp.WSGIApplication(
[('/twitter', Process_new_DM)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
已经有一个名为['email'](http://docs.python.org/library/email.html)的stdlib库;也许你需要重新命名以防止加载错误的库? –
欢迎来到Stack Overflow。感谢格式良好和详细的问题。祝你好运! – bohney
@MartijnPieters啊..我愚蠢。那样做了。谢谢。 – ldbrooke