Tips for Building High-Quality Django Apps at Scale
blog.doordash.com
Tips for Building High-Quality Django Apps at Scale
1–10 of 125 posts
Re: Tips for Building High-Quality Django Apps at Scale
#2This seems to me to be somewhat unpythonic, unnecessary complexity introduced right from the start - why not make the reuse optional?. The file system layout becomes confusing as a result. More generally, I would expect that the most minimal Django site would be a single file, that would seem most Pythonic, but it isn't designed like that. Django doesn't "feel" like most Python projects do.
I've always assumed this must be because I'm a total noob/idiot when it comes to real-world development, and that projects like Django must be doing things right and I just don't get it (although it remains entirely possible that this is the case).
It's heartening, however, to see I'm at least not _entirely_ wrong for having a gut unease about this, and it makes me wonder how on earth I can judge whether it's me or a given framework/language in the general case.
Do I have reverse Dunning–Kruger? Or did I just guess right in this case? I have no idea.
Re: Tips for Building High-Quality Django Apps at Scale
#3Re: Tips for Building High-Quality Django Apps at Scale
#4The only things I would agree with is the point about project layout and avoiding django's squashmigrations for the truncate the migrations table, delete the migrations, and create a new initial migration.
Practically everything else in this article is wrong, in my opinion.
Re: Tips for Building High-Quality Django Apps at Scale
#5I'm so glad to see the mention of "app" directories here. I've only dabbled in Django development, but I've always thought the desire to divide things into apps didn't really make any sense. It felt like the developers of Django had said "well, intuitively, there must be some unit of reuse at this level" and then stuck the notion of apps in there in an attempt to provide that reuse. This seems to me to be somewhat un…
And I think "apps" _do_ make sense in certain contexts. Consider this situation:
- I start a "polls" app like the Django docs example.
- I get a lot of users and they like my functionality, so I want to engage the community.
- I decide to start publishing blog posts, but I'm too lazy to spin up a whole new Wordpress install
- I find a "blog" app and drop that into my project with the '/blog' URL prefix.
Now I can start writing blog posts right away and anyone can go to my site '/blog' and see it. There are no cross-app database dependencies to worry about.
The same would be true for adding a basic "social" app that shows a user-profile page for django Users at '/users/' or something like that.
Re: Tips for Building High-Quality Django Apps at Scale
#6I've got more than 5 years of experience with Django on a number of teams and at a couple of companies and in my experience almost everything in this article is completely incorrect. The only things I would agree with is the point about project layout and avoiding django's squashmigrations for the truncate the migrations table, delete the migrations, and create a new initial migration. Practically everything else in…
Re: Tips for Building High-Quality Django Apps at Scale
#7I'm so glad to see the mention of "app" directories here. I've only dabbled in Django development, but I've always thought the desire to divide things into apps didn't really make any sense. It felt like the developers of Django had said "well, intuitively, there must be some unit of reuse at this level" and then stuck the notion of apps in there in an attempt to provide that reuse. This seems to me to be somewhat un…
Part of it is that Django has been around for quite a while now. It's maybe _the_ most succesful Python framework out there, so there are some paradigms that aren't common anymore but are hold-overs from years past. In particular, it pre-dates the current "microservice" trend and assumes a fairly monolithic environment. And I think "apps" _do_ make sense in certain contexts. Consider this situation: - I start a "poll…
Re: Tips for Building High-Quality Django Apps at Scale
#8I've got more than 5 years of experience with Django on a number of teams and at a couple of companies and in my experience almost everything in this article is completely incorrect. The only things I would agree with is the point about project layout and avoiding django's squashmigrations for the truncate the migrations table, delete the migrations, and create a new initial migration. Practically everything else in…
So I can't really tell which of you has a better point, or is better in context and so forth.
I do, however, see that the authors wrote a long article, and backed up each point with an example of what could go wrong and how to avoid it.
You, on the other hand, just asserted that you largely disagree.
So if you disagree, perhaps you can take some place where you feel they were particularly wrong and explain why. Otherwise, we are left with the impression that they are correct.
Re: Tips for Building High-Quality Django Apps at Scale
#9I'm so glad to see the mention of "app" directories here. I've only dabbled in Django development, but I've always thought the desire to divide things into apps didn't really make any sense. It felt like the developers of Django had said "well, intuitively, there must be some unit of reuse at this level" and then stuck the notion of apps in there in an attempt to provide that reuse. This seems to me to be somewhat un…
Yes, let's say you install a module that has a specific Django functionality from pypi, it will typically be installed as an app.
It confuses newbies sometimes who think that they need to worry about how to divide up their application into different applications. 99% of the time they don't and shouldn't (putting everything in a single app called 'core' in your project is a pretty common pattern).
Unfortunately the docs were never very clear on this.
>This seems to me to be somewhat unpythonic, unnecessary complexity introduced right from the start - why not make the reuse optional?. The file system layout becomes confusing as a result. More generally, I would expect that the most minimal Django site would be a single file, that would seem most Pythonic, but it isn't designed like that.
It can be made to behave like that if you really want:
http://olifante.blogs.com/covil/2010/04/minimal-django.html
Most people aren't using Django for that though, so it's not widely advertised nor known.
>It's heartening, however, to see I'm at least not _entirely_ wrong for having a gut unease about this,
It's not like the framework is perfect. There's plenty wrong with it, but it largely managed not to fuck everything up, which is pretty rare.
Re: Tips for Building High-Quality Django Apps at Scale
#10I've got more than 5 years of experience with Django on a number of teams and at a couple of companies and in my experience almost everything in this article is completely incorrect. The only things I would agree with is the point about project layout and avoiding django's squashmigrations for the truncate the migrations table, delete the migrations, and create a new initial migration. Practically everything else in…
>If you don't really understand the point of apps, ignore them and stick with a single app for your backend. You can still organize a growing codebase without using separate apps.
This is where the article lost me. If this is for building at scale, maybe, I don't know. I never hit a point where designing the project in apps became a problem. Regardless, if you don't know why Django wants to use apps, that suggests you are new to Django and probably not building at scale, so this feels like poor advice. Much of the article is telling readers to do things exactly contrary to Django's philosophy; the problem with that is there are lots of articles and StackOverflow answers out there based on Django's philosophy. There isn't a similar body of reference based on the authors' approach.
I don't know why explicitly naming your database tables is imperative for running at scale. Now we're breaking from Django's convention because some day we might want to stop using Django and we will be annoyed by its table-naming convention? Avoiding "fat models" is another place where it feels more like opinion than anything to do with performance or good design.
It would be good to know what database engine the authors are running into such serious migration issues with-- MySQL?