This is a fantastic video I wish more people made. Getting something to work can be fairly easy, but structuring the project logically comes only with experience. This is going to help a lot of people (including me).
This video is sooo helpful, for anyone who wants to restructure into folders in the future just change .extensions to ..extensions. Also for me I had to import the views after I inited the db with the app
I read on a SO post that one should use the already "initialized" db object to create the db model class. Although I structured my app the same way you did, I didn't have issues with my app. Everything was all good. Is it recommended to use your method? And how about extensions that need extra configuration after their "extension.init_app()" call
That's hard to answer, but you should only need instance of Flask-Dance and then you check if they're authorized in the parts of the app you want ot keep protected.
Hi Anthony i have a small question how will i add data to my db in views.py I import db from extension And did db.session.add() And it in giving me an error saying that Application not found
I have multiple applications in blueprint structure, but I'm struggling to access this db object inside applications and use it to create tables. I want to create model.py file for each application separately
File "C:\Users\User\Desktop\Flask\clean\app_stracture\__init__.py", line 3, in from .views import main ImportError: attempted relative import with no known parent package
It should be something like from myapp.views import main where myapp is the name of the folder containing the __init__.py in your case I guess it is app_stracture Avoid at all cost naming folder like "app_stracture" try making it simple like cleanapp, appclean, structureapp etc
Hey mate....cool video....but what if I want to use a class of different flask project, how can I import it ??note: they both are in different local disc's say E and F
You don't want to import from other parts of your computer because once you move you project, it will stop working. Instead either install things as a package or move them into your project.
Join my free course on the basics of Flask-SQLAlchemy: prettyprinted.com/flasksql
This is a fantastic video I wish more people made. Getting something to work can be fairly easy, but structuring the project logically comes only with experience. This is going to help a lot of people (including me).
I'm glad it helps! Thanks for watching.
This video is sooo helpful, for anyone who wants to restructure into folders in the future just change .extensions to ..extensions.
Also for me I had to import the views after I inited the db with the app
Great job Anthony this is exactly what I was looking for
anthony i love your teaching. Your code is so clean
Thank you so much!
TQ sir ,this is really awesome flask structure to work with.
Very useful. Just one question -> how to create database from console with create_app and .extensions. Thanks for your for your work and insights
Check out my video commands. ua-cam.com/video/wyG3BiL-E5c/v-deo.html
I read on a SO post that one should use the already "initialized" db object to create the db model class. Although I structured my app the same way you did, I didn't have issues with my app. Everything was all good.
Is it recommended to use your method? And how about extensions that need extra configuration after their "extension.init_app()" call
Great video! Thanks!
You're welcome!
Hi Anthony,
How do I setup a project with multiple app and blueprints and setup flask dance for all of them .
That's hard to answer, but you should only need instance of Flask-Dance and then you check if they're authorized in the parts of the app you want ot keep protected.
@@prettyprinted Thanks Anthony
Hi Anthony i have a small question how will i add data to my db in views.py
I import db from extension
And did db.session.add()
And it in giving me an error saying that
Application not found
from . extension import db
@@prabhashswain1878 thanks for answering i figured it out
Thanks anyway
I have multiple applications in blueprint structure, but I'm struggling to access this db object inside applications and use it to create tables.
I want to create model.py file for each application separately
hi bro! i want to selected file path or selected folder how can i do ?? (Without save file)
Basic question (but I am a newer user): what is blueprint?
A blueprint allows you to separate your endpoints (or routes) into seperate files.
thanks.
You're welcome.
how to setting port or host in this pattern
what is in .env and .flaskenv file?
Is your website built with flask?
It isn't. For the main site it's just HTML. The part for the courses is hosted by Teachable.
@@prettyprinted Can something like that be built with flask, the course part?
@@wilsonreuben5307 Yeah definitely. I eventually want to remake the site and I might use Flask.
File "C:\Users\User\Desktop\Flask\clean\app_stracture\__init__.py", line 3, in
from .views import main
ImportError: attempted relative import with no known parent package
Hi, did you manage solve this errror?
It should be something like
from myapp.views import main
where myapp is the name of the folder containing the __init__.py in your case I guess it is app_stracture
Avoid at all cost naming folder like "app_stracture" try making it simple like cleanapp, appclean, structureapp etc
Hey mate....cool video....but what if I want to use a class of different flask project, how can I import it ??note: they both are in different local disc's say E and F
You don't want to import from other parts of your computer because once you move you project, it will stop working. Instead either install things as a package or move them into your project.