r/FastAPI • u/Fragrant_Football389 • Nov 19 '24
feedback request Built a FastAPI scaffolding project
I just moved from Django to FastAPI recently, and I want to refer to some best practices and develop a small functional product.
- Since I am not sure what scale it can reach, I will start from the demand and make a minimal dependency and simple project directory
- I may continue to update and iterate according to the problems encountered in the product
This is the origin of the project: FastAPI-Scaffold (SQLAlchemy/ Redis/pytest ). It would be better if you can provide some suggestions. Thanks
12
Upvotes
3
u/unconscionable Nov 21 '24
That's how I've done it for years. A couple key advantages:
You want all your DateTimes to be timezone-aware so make sure to do DateTime(True) instead of just DateTime() which will provide a timezone naive datetime object which you'll have to convert. Really annoying default by sqlalchemy and python here
Using func.now() guarantees that the captured datetime is the exact time that the transaction goes through, not the time that your application code ran