Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

day10: 点击注册后页面出现:网络好像出问题了 (HTTP 500) #38

Open
tianke0711 opened this issue Dec 14, 2017 · 1 comment

Comments

@tianke0711
Copy link

tianke0711 commented Dec 14, 2017

我按照廖老师的教程,想注册一个用户名后点击提交有错误,希望帮我解决一下:
点击后页面出现:网络好像出问题了 (HTTP 500)

INFO:root:server started at http://127.0.0.1:9000...
INFO:root:Request: GET /register
INFO:root:Response handler...
INFO:root:call with args: {}
INFO:aiohttp.access:127.0.0.1 - - [14/Dec/2017:07:54:29 +0000] "GET /register HTTP/1.1" 200 6587 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
INFO:root:Request: POST /api/users
INFO:root:Response handler...
INFO:root:call with args: {'email': '[email protected]', 'name': 'ka', 'passwd': '4ff03fb6437edad36af5fd180c42ec483983c1fc'}
/Users/k.den/awesome-python3-webapp/www/handlers.py:132: RuntimeWarning: coroutine 'Model.findAll' was never awaited
users = yield from User.findAll('email=?', [email])
ERROR:aiohttp.server:Error handling request
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 417, in start
resp = yield from self._request_handler(request)
File "/anaconda3/lib/python3.6/site-packages/aiohttp/web.py", line 289, in _handle
resp = yield from handler(request)
File "app.py", line 43, in logger
return (await handler(request))
File "app.py", line 61, in response
r = await handler(request)
File "/anaconda3/lib/python3.6/site-packages/aiohttp/web_urldispatcher.py", line 111, in handler_wrapper
result = yield from result
File "/Users/den/awesome-python3-webapp/www/coroweb.py", line 138, in call
r = yield from self._func(**kw)
File "/anaconda3/lib/python3.6/asyncio/coroutines.py", line 213, in coro
res = yield from res
File "/Users/den/awesome-python3-webapp/www/handlers.py", line 132, in api_register_user
users = yield from User.findAll('email=?', [email])
TypeError: cannot 'yield from' a coroutine object in a non-coroutine generator

@tianke0711 tianke0711 changed the title 点击注册后页面出现:网络好像出问题了 (HTTP 500) day10: 点击注册后页面出现:网络好像出问题了 (HTTP 500) Dec 14, 2017
@luyangong
Copy link

函数前面加async;再把yield from 改成await就行了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants