I have a question regarding the architecture and use of Python Dash, and I’d appreciate any insights or discussion on the topic.
I’m currently building a web application, and based on the documentation, there are numerous ways to work with multi-pages, multi-layouts, etc.
Given this, what is the best structure or approach to use the library in order to develop a well-structured and scalable application? Should I use the multi-pages module? Alternate between layouts? Or is there a specific logical architecture that works best?
In my specific case, I currently have three files: a login page, a home page, and another distinct page. However, my code is becoming a mess because there are so many ways to implement things when you’re not fully familiar with the best practices, and now my code has turned into a Frankenstein. Every time I try to reorganize it, I discover another way to improve it, which forces me to refactor the entire codebase.
Any guidance or advice would be greatly appreciated!
Depending on your preferences you can create a callbacks.py file in the pages directories or construct the callbacks in class Components.
Either way, I would recommend using ID classes to structure and pass Ids to callbacks. This makes also a bit easier when composing bigger components.