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

我发现在数据库后台新增加的数据 需要我重新启动服务刷新才会出现请问这个和数据库连接有关系么 #17

Closed
Orange-YXH opened this issue Apr 24, 2023 · 1 comment

Comments

@Orange-YXH
Copy link

我使用的是create_async_engine 创建的异步数据库引擎
`
engine = create_async_engine(url='mysql+aiomysql://root:123456@localhost:3306/fastapi')

使用JwtTokenStore创建auth对象

auth = Auth(
db=AsyncDatabase(engine),
token_store=JwtTokenStore(secret_key='1558858285966')
)

将auth对象传入AdminSite

site = AuthAdminSite(
settings=Settings(database_url_async='mysql+aiomysql://root:123456@localhost:3306/fastapi'),
auth=auth
)`

@amisadmin
Copy link
Owner

将auth的db对象和site的db对象使用同一个, 你这样虽然是相同的数据库连接,但是他会创建两个db对象

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