6-315/www/test.py

23 lines
646 B
Python

import asyncio
import orm
from models import User
async def test(loop):
global i
i=1
await orm.create_pool(user='root', password='123456', db='demo',loop=loop)
a = User(name='Administrator', email='admin@example.com', password='123456', image='about:blank',id=i)
i+=1
x = User(name='gjj', email='gjj@example.com', password='123456', image='about:blank',id=i)
i += 1
t = User(name='roro', email='roro@example.com', password='123456789', image='about:blank',id=i)
await a.save()
await x.save()
await t.save()
loop = asyncio.get_event_loop()
loop.run_until_complete(test(loop))