困扰了好久了,请帮助
Topic source同学,我也再这里被卡了几天,终于被我发现了。参数为空,是因为handlers类中的User.FindAll查询不到。然后就应该回想这个方法的文件了,请看day8,ORM文件。(结束语。。。。。。。。廖老师。。。。。。。。。。。)
也遇见了这个问题 原因在错误中这句话: TypeError: index() missing 1 required positional argument: 'request'
解决方案: 你应该是缺少 day7中的coroweb.py的129行到135行
在coroweb.py的129行到135行有关键的两行: if self._has_request_arg: kw['request'] = request
- 1
捏捏困伐醒
c:\python36\awesome-python3-webapp\www>python app.py INFO:root:create database connection pool... INFO:root:init jinja2... INFO:root:set jinja2 template path: c:\python36\awesome-python3-webapp\www\templ ates INFO:root:and route GET / => index(request) INFO:root:add static /static/ => c:\python36\awesome-python3-webapp\www\static INFO:root:server started at http://127.0.0.1:9000... INFO:root:logger_factory&Request: GET / INFO:root:response_factory:Response handler... INFO:root:call with args: {} ERROR:aiohttp.server:Error handling request Traceback (most recent call last): File "C:\Users\huangxugang\AppData\Local\Programs\Python\Python35\lib\site-pac kages\aiohttp\web_protocol.py", line 381, in start resp = await self._request_handler(request) File "C:\Users\huangxugang\AppData\Local\Programs\Python\Python35\lib\site-pac kages\aiohttp\web_app.py", line 322, in _handle resp = await handler(request) File "C:\Users\huangxugang\AppData\Local\Programs\Python\Python35\lib\site-pac kages\aiohttp\web_middlewares.py", line 88, in impl return await handler(request) File "app.py", line 60, in logger return (await handler(request)) File "app.py", line 67, in response r = await handler(request) File "C:\Users\huangxugang\AppData\Local\Programs\Python\Python35\lib\site-pac kages\aiohttp\web_urldispatcher.py", line 161, in handlerwrapper result = await result File "c:\python36\awesome-python3-webapp\www\coroweb.py", line 145, in __call _ r = await self._func(kw) File "C:\Users\huangxugang\AppData\Local\Programs\Python\Python35\lib\asyncio\ coroutines.py", line 210, in coro res = func(*args, kw) File "c:\python36\awesome-python3-webapp\www\coroweb.py", line 22, in wrapper return func(args,*kw) TypeError: index() missing 1 required positional argument: 'request'
call with args 返回的参数为空,等问题