michaelliao / awesome-python3-webapp

小白的Python入门教程实战篇
https://liaoxuefeng.com/books/python/
GNU General Public License v3.0
2.4k stars 2.8k forks source link

day4 最后test的时候出现awesome.user doesnt exist的报错 #51

Open soringswath opened 5 years ago

soringswath commented 5 years ago

Traceback (most recent call last): File "/Users/liulizhong/awesome-python3-webapp/www/test.py", line 15, in loop.run_until_complete(insert(loop)) File "/anaconda3/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete return future.result() File "/Users/liulizhong/awesome-python3-webapp/www/test.py", line 11, in insert await u.save() File "/Users/liulizhong/awesome-python3-webapp/www/orm.py", line 233, in save rows = await execute(self.insert,args) File "/Users/liulizhong/awesome-python3-webapp/www/orm.py", line 48, in execute await cur.execute(sql.replace('?', '%s'), args) File "/anaconda3/lib/python3.6/site-packages/aiomysql/cursors.py", line 237, in execute await self._query(query) File "/anaconda3/lib/python3.6/site-packages/aiomysql/cursors.py", line 455, in _query await conn.query(q) File "/anaconda3/lib/python3.6/site-packages/aiomysql/connection.py", line 420, in query await self._read_query_result(unbuffered=unbuffered) File "/anaconda3/lib/python3.6/site-packages/aiomysql/connection.py", line 607, in _read_query_result await result.read() File "/anaconda3/lib/python3.6/site-packages/aiomysql/connection.py", line 1089, in read first_packet = await self.connection._read_packet() File "/anaconda3/lib/python3.6/site-packages/aiomysql/connection.py", line 578, in _read_packet packet.check_error() File "/anaconda3/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error err.raise_mysql_exception(self._data) File "/anaconda3/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.ProgrammingError: (1146, "Table 'awesome.user' doesn't exist")

源码是 import orm , asyncio from models import User, Blog, Comment

async def insert(loop): await orm.create_pool(loop = loop, user='liusanshui', password='12345', db='awesome')

u = User(name='Test', email='1233445@qq.com', passwd='1234567890', image='about:blank')

await u.save()

loop = asyncio.get_event_loop() loop.run_until_complete(insert(loop)) loop.run_forever()

for x in insert(loop): pass

有没有大牛能帮忙看一下

xingdongzhe commented 5 years ago

你在数据里面建表了吗?在mysql 里面建立awesome数据库,在该数据库中建user表

wolflb commented 5 years ago

没啊

在 2019-05-16 21:59:28,"行动zhe" notifications@github.com 写道:

你在数据里面建表了吗?在mysql 里面建立awesome数据库,在该数据库中建user表

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

lindonge commented 5 years ago

yes

wolflb notifications@github.com于平成31年5月27日周一上午10:20写道:

没啊

在 2019-05-16 21:59:28,"行动zhe" notifications@github.com 写道:

你在数据里面建表了吗?在mysql 里面建立awesome数据库,在该数据库中建user表

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/michaelliao/awesome-python3-webapp/issues/51?email_source=notifications&email_token=AGTD55DROWWZKN6MGZD2GE3PXMZNNA5CNFSM4G3F5T22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWIRT6Q#issuecomment-496048634, or mute the thread https://github.com/notifications/unsubscribe-auth/AGTD55BMDGOTMEUFJ46GPE3PXMZNNANCNFSM4G3F5T2Q .