starting a site, haven’t used django in about 10 years now. wondering if there are any good documented patterns to follow.
mainly around MODEL/CRUD. I saw some scaffolding libraries out there to help with that, but before i committed to it, i thought i’d be ok just following a good blueprint. Which the blueprint would become painfully obvious to me after 3-4 of them and a ton of mistakes. just thought i’d avoid that if i can.
Even though you do have a background in Django, I think you could start to get your “Django legs” working again by working through both the standard Django tutorial and/or the Django Girls tutorial.
Both provide examples of building applications using current practices for models, views, and templates. There have been a lot of changes over the past 10 years…
Another really good resource I’ve come to love over time is Feldroy’s ‘Two Scoops of Django’ book that he regularly updates. You’d have to purchase the book for ~$50, but, in my opinion, it’s a fantastic investment for best practices and nifty little design tips throughout the main modules of a Django application.
i have gone through the tutorial to get me started. my development experience typically tells me the tutorials usually get you going well, but more advanced features/patterns can really cut down on the repetitive code. as you said there has been a lot of changes, didn’t know if there were some secrets/shortcuts i should know about.
like url pattern, template, base view, form, combos to use for crud operations
the documentation is great and im sure im going to come across everything i need eventually and as i build it go “dam wish i knew that earlier”. I thought I would ask if that was compiled somewhere in a package for me to consume, it would save me some time.
no biggy if not, nothing like experience to learn.
In this case the tutorials do that. Specifically, part 4 of the Django tutorial introduces the generic CBVs, which can be very useful in reducing repetitive code across views. As part of that, it also introduces the basic pattern of “ListView/DetailView” which can form the foundation of just about any typical app.
I believe the Django Girls tutorial goes into more depth into creating templates and styling them with css, making it a good complement to the standard Django tutorial.
I think between the two of them you’ll cover all the basics.
Once you get beyond that stage, there isn’t much that can be said outside the specifics of a particular application. The Two Scoops of Django book referenced above is an excellent resource, filled with all sorts of ideas and recommendations. However, they’re not rules so much as guidelines, ideas, and recommendations - always acknowledging that there are cases and situations where those guidelines don’t apply.
One of the problems is that there are some techniques and features whose purpose and usage may not be immediately apparent on first reading. You pretty much need to be in one of those situations asking yourself “I wonder if Django can do x” before having that a-ha moment and realizing that it’s precisely for that reason that feature x exists. </opinion>