This is great and showcases Django's talent for basic CRUD apps with handy admin interfaces.
One catch: I like to deploy static sites to GitHub Pages. It turns out the Django ecosystem has an answer for that in the form of Django Distill [1]. Distill adds a new management command that generates static content by repeatedly invoking your views.
I've used Distill to build quite a few static sites. It's great to be able to deploy to Pages but use Django's admin UI locally. Typically, for these sites, I check in my 'production' SQLite database directly to my git repo.
(Combine this pattern with GitHub actions and you can do a lot with a little. For instance, here's a toy I built to summarize upcoming Seattle city council meetings [2].)
Simon Willison calls it the “baked data pattern” — where a read-only copy of your data is checked into your repo alongside your code. [1]
(And, just to tie the threads together, that’s the same Simon who wrote the OP we’re all commenting on, and who is also the co-creator of Django and more recently of the very handy Datasette!)
I had the opposite opinion. If you were trying to convert Rails, Laravel or CakePHP users, this would just convince them that Django was more manual and involved than those frameworks. It would be better to utilize extensions like `scaffolding` to give a more equivalent workflow. It does demonstrate general MVC benefits and architecture, however.
I was recently looking for a static site generator for a local relay race I help organize and django-distill was the top of my list. I ended up writing my own SSG because I had very little HTML that actually had to be generated on the site. But might check out django-distill in the future if you found it worth learning.
Can you think of a complicated app that utilizes Django to its fullest extent? I'm trying to get a better view of what Django is capable of and I find it's helpful to see both the simplest example possible and the most complicated example possible. "Design for the extremes" as Don Norman would say.
Instagram's backend is a Django monolith "with several million lines of code and a few thousand Django endpoints" as of 2019, and the same architecture was used for Threads! They now run Django on a JIT-enabled fork of CPython, and leverage a ton of internal tooling for static analysis and strong typing.
Django is also excellent for e-commerce with projects like https://github.com/saleor/saleor - or you can roll your own e-commerce system quite easily, which we've done at my travel startup.
The wagtail CMS would be a good example of more complex systems built on top of Django. https://wagtail.org/
One of the many more complex sites we've used it to build is https://www.business-humanrights.org/en/ which tracks over 10k companies, 100k+ articles in 15 or so languages. We've also built internal dashboards, live updating forums, donations platforms and so on. Another interesting one might be https://www.achurchnearyou.com/ which is used by the church of England to provide "mini sites" for all their congregations around England, so several thousand church administrators use that every week.
I've been involved with several enterprise applications based off of Django - leveraging signals, custom models, tasks, etc. to power insurtech and fintech applications.
I have been using Django for 10 years and it still is my tool of choice when I need to build something quickly that needs a full HTML and form handling interface.
There is an excellent tool - https://djangobuilder.io/ that can also really speed up the boilerplate even more.
Django has been my go to framework for any new web project I start for more than a decade. Its batteries-included approach meant that one could go pretty far with just Django alone. Included admin interface and the views/templating setup was what first drew me to the project.
Django project itself has kept pace with recent developments in web development. I still remember migrations being an external project, getting merged in and the transition that followed. Ecosystem is pretty powerful too with projects like drf, channels, social-auth etc., covering most things we need to run in production.
https://github.com/trypromptly/LLMStack is a recent project I built entirely with Django. It uses django channels for websockets, drf for API and reactjs for the frontend.
IMHO Django is what really catapults Python as one of the leading contender of interpreted programming languages for web development in the presence of the other popular ones namely Perl, Ruby, TCL and PHP. After many people started using Python for web development made popular by web framework like Zope and Django, then they stay and keep using it because it's relatively easy to program. Above all it's easier to grok and maintain due to its ancestor being ABC language. It also adopted identation and made it mandatory mainly for readability reason since most of the popular programs has more than one programmer or maintainer.
Initially though Python got a lot of flak for this mandatory identation feature but later it's really its main advantage against other interpreted programming language of its time and programmers consider it a language with pseudo-like codes, but with functionality. Then come the era of data science and analytics popularity where Fortran and Matlab were kings, but the former is too primitive and the latter is a proprietary language. Interestingly, Guido himself was involved with new Python matrix operation syntax in order to make it more intuitive. Due to the rise of AI and machine learning where matrix operations are pervasive, Python becoming the best open source alternative and the rest is history. This is a very interesting read on HN for the reasons why Python win over its competitor and now the most popular language on the planet:
I write and maintain content for a living. Switching to a static site generator is the best thing I have done for my productivity since I started that website.
Powerful text editing tools I'm familiar with, source control, fully offline work, and very lightweight tooling that starts quickly (just a python script).
god i love django. it could use a little bit of modernization and modularization to ease the json api and deploy pain points, but it's still the best python web framework by a long shot and it would be deserving of way more manpower than it has.
but emoji laden docs and 500/month patreon pay better than contributing to established things i guess
Yes, absolutely know DRF. The only problem is that DRF adds another very heavy pile of documentation to read to start working with it, with some footguns (e.g. ModelSerializers being very very slow, at least some years ago).
I'd rather have DRF (a subset maybe) inside django. No external dependencies and integrated auth could enable interesting patterns like complete modularization of the admin panel, making it json api driven and making deploys very easy such as `python manage.py generateadmin` and you can load that on S3 or whatever.
I also know the existence of whitenoise + many workarounds, but python is already a quirky language, django has its own and its starting to have a huge chunk of incidental complexity (my last django project, very mature codebase, had like 3 libs to work with JWTs...) to work proficiently with. Not to mention the footguns of it!
People like options, but with opinionated frameworks I'd rather have lack of them.
This is how simple Django is for CRUD apps. The author could go even sparser. Love them or hate them, the views could have been replaced with class based model views for even less lines of code.
Fewer lines of code, perhaps, but in terms of explicitness, clarity, and ease of maintainability I find myself strongly favoring the functional approach for this case.
I've been using Django for a number of years now and it's my go-to for any web app that requires any kind of dynamic content (especially user generated). DRF similarly for any REST related work fits in perfectly, but aside from that it's really refreshing to have a framework which doesn't require a tonne of other dependencies to get something decent off the ground.
One catch: I like to deploy static sites to GitHub Pages. It turns out the Django ecosystem has an answer for that in the form of Django Distill [1]. Distill adds a new management command that generates static content by repeatedly invoking your views.
I've used Distill to build quite a few static sites. It's great to be able to deploy to Pages but use Django's admin UI locally. Typically, for these sites, I check in my 'production' SQLite database directly to my git repo.
(Combine this pattern with GitHub actions and you can do a lot with a little. For instance, here's a toy I built to summarize upcoming Seattle city council meetings [2].)
[1] https://github.com/meeb/django-distill
[2] https://scc.frontseat.org/ -- source at https://github.com/front-seat/engage
Simon Willison calls it the “baked data pattern” — where a read-only copy of your data is checked into your repo alongside your code. [1]
(And, just to tie the threads together, that’s the same Simon who wrote the OP we’re all commenting on, and who is also the co-creator of Django and more recently of the very handy Datasette!)
[1] https://simonwillison.net/2021/Jul/28/baked-data/
I had the opposite opinion. If you were trying to convert Rails, Laravel or CakePHP users, this would just convince them that Django was more manual and involved than those frameworks. It would be better to utilize extensions like `scaffolding` to give a more equivalent workflow. It does demonstrate general MVC benefits and architecture, however.
I was recently looking for a static site generator for a local relay race I help organize and django-distill was the top of my list. I ended up writing my own SSG because I had very little HTML that actually had to be generated on the site. But might check out django-distill in the future if you found it worth learning.
https://instagram-engineering.com/types-for-python-http-apis...
https://engineering.fb.com/2023/09/07/culture/threads-inside...
https://engineering.fb.com/2022/05/02/open-source/cinder-jit...
https://engineering.fb.com/?s=django
Django is also excellent for e-commerce with projects like https://github.com/saleor/saleor - or you can roll your own e-commerce system quite easily, which we've done at my travel startup.
One of the many more complex sites we've used it to build is https://www.business-humanrights.org/en/ which tracks over 10k companies, 100k+ articles in 15 or so languages. We've also built internal dashboards, live updating forums, donations platforms and so on. Another interesting one might be https://www.achurchnearyou.com/ which is used by the church of England to provide "mini sites" for all their congregations around England, so several thousand church administrators use that every week.
There is an excellent tool - https://djangobuilder.io/ that can also really speed up the boilerplate even more.
Django project itself has kept pace with recent developments in web development. I still remember migrations being an external project, getting merged in and the transition that followed. Ecosystem is pretty powerful too with projects like drf, channels, social-auth etc., covering most things we need to run in production.
https://github.com/trypromptly/LLMStack is a recent project I built entirely with Django. It uses django channels for websockets, drf for API and reactjs for the frontend.
Initially though Python got a lot of flak for this mandatory identation feature but later it's really its main advantage against other interpreted programming language of its time and programmers consider it a language with pseudo-like codes, but with functionality. Then come the era of data science and analytics popularity where Fortran and Matlab were kings, but the former is too primitive and the latter is a proprietary language. Interestingly, Guido himself was involved with new Python matrix operation syntax in order to make it more intuitive. Due to the rise of AI and machine learning where matrix operations are pervasive, Python becoming the best open source alternative and the rest is history. This is a very interesting read on HN for the reasons why Python win over its competitor and now the most popular language on the planet:
[1] Ask HN: Why did Python win?
https://news.ycombinator.com/item?id=37308747
Django and Wordpress are still valid use case for a blog.
Powerful text editing tools I'm familiar with, source control, fully offline work, and very lightweight tooling that starts quickly (just a python script).
I wrote a bit about the experience here: https://nicolasbouliane.com/projects/ursus
Then again, with Django-Distill (linked above), you can get the best of both worlds.
but emoji laden docs and 500/month patreon pay better than contributing to established things i guess
I'd rather have DRF (a subset maybe) inside django. No external dependencies and integrated auth could enable interesting patterns like complete modularization of the admin panel, making it json api driven and making deploys very easy such as `python manage.py generateadmin` and you can load that on S3 or whatever.
I also know the existence of whitenoise + many workarounds, but python is already a quirky language, django has its own and its starting to have a huge chunk of incidental complexity (my last django project, very mature codebase, had like 3 libs to work with JWTs...) to work proficiently with. Not to mention the footguns of it!
People like options, but with opinionated frameworks I'd rather have lack of them.
``` commit 53eddd4a0f8786e23f511a653d8d7ffa947ad8db Author: Simon Willison <simon@simonwillison.net> Date: Mon Apr 23 21:24:41 2007 +0000
```There are earlier references as well, but I think the author was making pretty deliberate choices.
Deleted Comment