I want to make an API with Flask and it also needs to have an admin panel. I guess that Blueprints are the way to go, but I don't want to make models twice.
My structure is going to be this:
- app
- api
- admin
- models
So my question is: How can I access the models in the models folder in my api blueprint and my admin blueprint?
Thanks in advance.
if you'd in a module within the
apioradminfolders you can import anything from a module in themodelsfolder using this notationfor small projects i usually keep all the models in a single models.py file like:
then from within any of your blueprint files just: