gpt4 book ai didi

python - 导入错误: No module named not_found

转载 作者:行者123 更新时间:2023-11-30 22:43:52 25 4
gpt4 key购买 nike

# -*- coding: UTF-8 -*-
import google
print google.__path__.append("C:\Program Files(x86)\Google\google_appengine")
import webapp2
form ="""
<form method ="post" action= "/testform">
<input name="q">
<input type="submit">
</form>
"""
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content­Type'] = 'text/plain'
self.response.out.write(form)
class TestHandler(webapp2.RequestHandler):
def get(self):
q = self.request.get("q")
self.response.out.write(q)

app = webapp2.WSGIApplication([
('/', MainPage),
('/testform',TestHandler),
], debug=True)

当我运行这个简单的应用程序时,它显示文本区域和提交,但是当我提交时,我收到 500 错误。在电源外壳上我得到以下信息:-

Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
ImportError: No module named not_found
INFO 2017-01-14 21:16:13,831 module.py:806] default: "POST /testform HTTP/1.1" 500 -

最佳答案

我猜你使用了app.yaml,这是一个例子 in Google AppEngine Docs .

如果您从 app.yaml 中删除以下两个 linse,则可以修复。

runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /
script: home.app

- url: /index\.html
script: home.app

- url: /stylesheets
static_dir: stylesheets

- url: /(.*\.(gif|png|jpg))$
static_files: static/\1
upload: static/.*\.(gif|png|jpg)$

- url: /admin/.*
script: admin.app
login: admin

- url: /.* // <- delete this
script: not_found.app // <- delete this

关于python - 导入错误: No module named not_found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41651956/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com