williamvongphan / p00_buttery-belligerent-blogger

Blog in Flask (cool)
MIT License
0 stars 0 forks source link

Amazing Coding Practices #3

Open abidtalukder opened 1 year ago

abidtalukder commented 1 year ago

I love how at the top of your init.py you imported a bunch of the python files that you coded in the render file. I think this is an amazing practice because it helps streamline your code, and it makes the code look so clean. By doing this, your also making it clear that the init.py is strictly used for bringing everything together and connecting all the different components. It is the central hub of your app.

Your Code: import render.index as render_index import render.login as render_login import render.register as render_register import render.onboarding as render_onboarding import render.create_blog as render_create_blog import render.newpost as render_newpost import render.blog as render_blog import render.post as render_post import render.homepage as render_homepage import render.edit_post as render_edit_post import render.delete_post as render_delete_post import render.edit_blog as render_edit_blog import render.delete_blog as render_delete_blog import render.four_oh_four as render_404 import render.five_hundred as render_500

williamvongphan commented 1 year ago

It isn't that clean 😶‍🌫️

Python unfortunately only looks for modules in its immediate directory so I can't call import render by itself and import all those functions, I have to import each directly. It was a big turn-off for me.