fastapi-users | Ready-to-use and customizable users management for FastAPI | REST library
kandi X-RAY | fastapi-users Summary
kandi X-RAY | fastapi-users Summary
Add quickly a registration and authentication system to your FastAPI project. FastAPI Users is designed to be as customizable and adaptable as possible.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of fastapi-users
fastapi-users Key Features
fastapi-users Examples and Code Snippets
Community Discussions
Trending Discussions on fastapi-users
QUESTION
I can use MongoDB with FastAPI either
- with a global
client: motor.motor_asyncio.AsyncIOMotorClient
object, or else - by creating one during the
startup
event per this SO answer which refers to this "Real World Example".
However, I also want to use fastapi-users since it works nicely with MongoDB out of the box. The downside is it seems to only work with the first method of handling my DB client connection (ie global). The reason is that in order to configure fastapi-users, I have to have an active MongoDB client connection just so I can make the db
object as shown below, and I need that db
to then make the MongoDBUserDatabase
object required by fastapi-users:
ANSWER
Answered 2021-Mar-13 at 18:56I don't think my solution is complete or correct, but I figured I'd post it in case it inspires any ideas, I'm stumped. I have run into the exact dilemma, almost seems like a design flaw..
I followed this MongoDB full example and named it main.py
At this point my app does not work. The server starts up but result results in the aforementioned "attached to a different loop" whenever trying to query the DB.
Looking for guidance, I stumbled upon the same "real world" example
In main.py
added the startup and shudown event handlers
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install fastapi-users
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page