作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
# -*- 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['ContentType'] = '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/
我是一名优秀的程序员,十分优秀!