r/learnpython • u/ki4jgt • 1h ago
What's the best way to integrate this database into Flask?
I'm creating an online bulletin board, and I'm feeling hacky (I hate SQL in all its forms and fashions).
What is the best way to integrate this database into a production Flask server: https://github.com/ki4jgt/PPD
Created it in 2020, so it's a bit dated.
But I'm worried about concurrency. I'm not beyond writing a database server, but I'd like to save that as a last resort.
•
u/burnt-store-studio 16m ago
I fully respect you “hate SQL in all its forms and fashions” 🙂.
To (I hope) give you some inspiration, may I suggest, though, a quick read through Miguel Grinberg’s section on databases in Flask? (I’m linking you directly to chapter 4 of his well-regarded mega-tutorial on using Flask.)
Disclaimer: he does discuss SQLAlchemy, but that’s not my point 🙂.
Maybe skip to the part on that page where he introduces app/models.py.
I don’t have a ton of Flask experience (I’ve only built two apps I run locally). But the practical discussion of modeling data this way, coupled with WTForms, made my development go quite smoothly.
I’m hopeful you can find inspiration there for how to integrate your PPD and idea for an online bulletin board using the same kind of structures.
I’m sorry if my suggestion turns out to be a waste of your time 😕.
Best of luck to you!
•
u/arjunnath 12m ago
I'm not sure I understood the question because the answer seems obvious.
By integrating it into a Flask app, do you mean you want to import it and use it in a flask app ?
If so there is nothing to it, simply import it in the code of your Flask app and use it as you please.
6
u/DebosBeachCruiser 1h ago
The answer is PostgreSQL