TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Django 4.0

473 pointsby Spiritusover 3 years ago

32 comments

rlawsonover 3 years ago
Django has allowed me to enjoy some side entrepreneurship. I have released three products as a solo part time dev that I would never have been able to do in a reasonable time using Java&#x2F;Spring (my strongest stack). My first project went nowhere, but the second generated 1k+ a month and sold for 50k, and the third one is following a similar trajectory.<p>My advice - keep it simple<p>- function based views<p>- centralize access to the ORM (avoid fat models, use a service layer)<p>- responsive bootstrap template with crispy forms<p>- minimal js<p>- 12 factor type setup - django-environ or similar<p>- be aware of n+1 select problem (I use django debug toolbar but looking into django-zen-queries)<p>- plop it on heroku, AWS lightsail, Digital Ocean or if containerizing use AWS Fargate<p>- avoid celery unless you are at a scale you need it - use django-cron, django-db-queue or similar<p>- use a managed database and managed email service<p>I have had zero scalability problems. People say Django is slow but it handled 10k active users on a small EC2 instance without any issues (static stuff served via cloudfront)
评论 #29473411 未加载
评论 #29472668 未加载
评论 #29472669 未加载
评论 #29476525 未加载
评论 #29474005 未加载
评论 #29492881 未加载
评论 #29478841 未加载
评论 #29472583 未加载
评论 #29497993 未加载
评论 #29476606 未加载
评论 #29474627 未加载
评论 #29476167 未加载
评论 #29477223 未加载
the__alchemistover 3 years ago
Django is the nicest framework I&#x27;ve come across! For some context, my favorite overall programming language is Rust. Despite Rust having several web frameworks, I use Python the server due to Django being so nice.<p>In Python, there are micro frameworks like Flask, and whatever new ones claim to be &quot;Blazingly fast!&quot;, async etc. Once you get over the learning curve, Django seems the nicest to use, due to including features like an auto-updating ORM, email, authentication, admin page etc. None of the Rust frameworks, in contrast, come close to feature parity.<p>Django&#x27;s feature base is vast, and I admit I don&#x27;t understand much of it. You can choose the feature sets you need. The template language is inflexible, but you can smooth this over using JS instead A&#x2F;R.
评论 #29473335 未加载
评论 #29473582 未加载
Majestic121over 3 years ago
We went all in on FastAPI with my team, but we&#x27;re hit the issue that the projects of Tiangolo (FastAPI, SQLModel, Typer) seem to be turning pretty much unmaintained : <a href="https:&#x2F;&#x2F;github.com&#x2F;tiangolo&#x2F;fastapi&#x2F;discussions&#x2F;3970" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tiangolo&#x2F;fastapi&#x2F;discussions&#x2F;3970</a><p>We&#x27;ve already been hit by multiple bugs with fixing PR opened, but left to rot, and missing documentation : the &#x27;tutorial&#x27; documentation is great, but if you want a reference you have to go read the code.<p>I guess that&#x27;s the issue when you pick projects maintained by one person, so for my next projects I might get back to something built on stronger grounds, like Django.<p>How is Django this day with modern Python constructs like typing in general and Pydantic models integration ?
评论 #29484907 未加载
评论 #29472643 未加载
评论 #29471688 未加载
评论 #29472101 未加载
评论 #29472303 未加载
评论 #29511716 未加载
评论 #29473911 未加载
评论 #29477274 未加载
nickjjover 3 years ago
If anyone is interested I updated my example Docker Django app to use Django 4.0 at: <a href="https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-django-example" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-django-example</a><p>It pulls together Django, Docker Compose, Postgres, Redis, Celery, Webpack and TailwindCSS. It&#x27;s all set up for both development and production. It&#x27;s also been updated to use Django 4&#x27;s new built in Redis cache back-end instead of the django-redis package.
评论 #29473555 未加载
ralmidaniover 3 years ago
Django made me fall in love with programming. I built 2 decent-sized side projects with Django. They didn’t gain traction, but I loved using the framework.<p>Then I went through a couple of (depressing) years of using Java&#x2F;Spring professionally, and recently I made the choice to move to Elixir&#x2F;Phoenix. It’s going great, and I don’t think I would go back to heavy OOP if I didn’t have to.<p>Some things I really miss from Django:<p>- Models with more centralized validation logic. In Phoenix (and somewhat similarly in Rails), you need to edit your migration, schema, and changeset. In Django, you edit your model and the migration can usually be made automatically with no need for a 3rd-party package.<p>- Django REST Framework. You can get pretty far with an app just by leveraging ModelSerializers and ModelViewsets. It’s ridiculously elegant, simple, and powerful.<p>- The Admin layer is fantastic and unparalleled.<p>Some things I wish Django would add&#x2F;enhance:<p>- Making it more clear when you’re going to hit the database (explicit is better than implicit).<p>- True async up and down the stack. Not a small task within the Python ecosystem, but I think for folks who are not already invested, looking at Elixir&#x2F;OTP&#x2F;Phoenix is too tempting. If you don’t have kids to transport with you, a Lambo looks much more fun than an S-Class Sedan.
评论 #29477851 未加载
评论 #29476741 未加载
avinasshover 3 years ago
I recently upgraded [0] one of my project [1] to Django v4, from Django v1. The changes from Django 3 to 4 were fairly simple, just one line change in my case. The change log is extremely detailed, it was easy to upgrade. Also, I found a tool called django-upgrade [2] which makes some changes automatically, rest I made manually.<p>[0] - <a href="https:&#x2F;&#x2F;avi.im&#x2F;blag&#x2F;2021&#x2F;rc-day-20&#x2F;" rel="nofollow">https:&#x2F;&#x2F;avi.im&#x2F;blag&#x2F;2021&#x2F;rc-day-20&#x2F;</a><p>[1] - <a href="https:&#x2F;&#x2F;github.com&#x2F;avinassh&#x2F;della" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;avinassh&#x2F;della</a><p>[2] - <a href="https:&#x2F;&#x2F;github.com&#x2F;adamchainz&#x2F;django-upgrade" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;adamchainz&#x2F;django-upgrade</a>
评论 #29472551 未加载
applikuover 3 years ago
Thank you Django. that’s a great news.<p>14 years ago someone helped me discover Python and Django.<p>I started from django official tutorial and never changed the framework of choice.<p>It was my hobby, my career, my tool to put the food on the table.<p>12 years later I have started building a way to solve deployment question.<p>started from bunch of scritps. today I have made cost effective tool to deploy Django projects and pretty much any python app on AWS&#x2F;Digital Ocean<p><a href="https:&#x2F;&#x2F;appliku.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;appliku.com&#x2F;</a><p>it is like heroku but uses you own cloud account and not expensive at all.
pantulisover 3 years ago
Before Django there was Zope in python-land.<p>I don&#x27;t think I overstate the relevance of what Django did by saying that Django almost single handledy advanced the state-of-the-art of web deployment in Python forward a decade.
评论 #29473156 未加载
WayToDoorover 3 years ago
While it doesn&#x27;t seem like a <i>major</i> update at first glance on this news piece, the changelog is available here : <a href="https:&#x2F;&#x2F;docs.djangoproject.com&#x2F;en&#x2F;4.0&#x2F;releases&#x2F;4.0&#x2F;" rel="nofollow">https:&#x2F;&#x2F;docs.djangoproject.com&#x2F;en&#x2F;4.0&#x2F;releases&#x2F;4.0&#x2F;</a><p>Of note, in my opinion :<p>- The new AddConstraintNotValid operation allows creating check constraints on PostgreSQL without verifying that all existing rows satisfy the new constraint, meaning that one can now create constraints on big postgres tables without a waiting period.<p>- Async methods are coming, to cache for now but hopefully soon to the ORM. They are prefixed with a `a` in the name<p>- DeleteView now uses FormMixin, allowing you to provide a Form subclass, with a checkbox for example, to confirm deletion. In addition, this allows DeleteView to function with django.contrib.messages.views.SuccessMessageMixin. This is a big thing if you use DeleteViews, as you can now easily show a message post-deletion to the user.
评论 #29471444 未加载
clement_bover 3 years ago
I enjoy coding with Django. It&#x27;s <i>the</i> framework that helped me make a smooth move from PHP&#x2F;Symfony to Python-powered web apps. Not that I dislike PHP... just wanted to focus more on Python.<p>Many thanks to everyone involved in the project!
theomegaover 3 years ago
Great news!<p>Just for reference: The latest release for Django Rest Framework is not compatible with Django 4.0 yet. At least my first attempts failed due to a missing `pytz` dependency. This is fixed in the `master` of DRF on Github. Installing `pytz` explicitly again to your project fixes DRF for now.
评论 #29471711 未加载
robomartinover 3 years ago
Love Django, yet the transition from local development to deployment, in my opinion, continues to be just plain ugly and painful.<p>I&#x27;ve written about this before. I think the stock Django dev configuration needs to change to something that is equivalent to a reasonable deployment on a common VPS, whatever that means. The development server is a nice trick, but the things you have to do to move to a real server are painful. Same with SQLite. Why not come up running PostgreSQL by default?<p>I am sure there are varied opinions on this. All I have to say is that, over the years, I developed a document to help with deployment on standard hosting platforms, like Linode. It is staggering when compared to the experience of deploying something like a Wordpress&#x2F;PHP site on the same or similar platform.<p>This, from my perspective, is the weakness for Django, everything else I love and enjoy.
评论 #29477315 未加载
poloteover 3 years ago
14 days ago <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29303611" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29303611</a><p>76 days ago <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28609188" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28609188</a><p>3 month ago <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28566044" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28566044</a>
nannaover 3 years ago
I must learn Django, it&#x27;s got everything I&#x27;ll ever need. No, Rails will make me happy and it&#x27;s better for lonely devs like me. No I must learn a Modern Web Framework (TM) to prove I&#x27;m not stuck in the past. No way, I&#x27;m not a fashionista. Have you seen that Phoenix demo where the guy builds Twitter in like 4 minutes? That&#x27;s the future. Hold on a minute, enough of this magic. I need to learn to build everything in Common Lisp and own my code 100%! Wait I don&#x27;t actually have the time for that. Django is the way, it&#x27;s so solid, just that it won&#x27;t bring me joy....
评论 #29471741 未加载
评论 #29471551 未加载
评论 #29471878 未加载
评论 #29471805 未加载
评论 #29471702 未加载
评论 #29471628 未加载
评论 #29471435 未加载
评论 #29471443 未加载
评论 #29471534 未加载
评论 #29472063 未加载
sam_goodyover 3 years ago
OT, but considering the audience...<p>I have a side project &#x2F; website that I want to work on. I have over a decade experience with PHP and JS in various forms, but am willing to try something new.<p>The idea of compiled languages don&#x27;t appeal to me, so am not really interested in Go, Rust or Dart. It looks like either Django, Elixir, or PHP - but am open to other ideas.<p>Anyone with enough experience to tell me confidently that it is worth Django or Elixir? Anyone can give a five line overview of the differences vs PHP or Node?<p>And along the way, am I the only one who is confused by what seems too many environments and package managers? (from venv&#x2F;virtualenv[1] to pip&#x2F;easy_install to wheels&#x2F;eggs)<p>[1]: <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;q&#x2F;41573587&#x2F;87520" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;q&#x2F;41573587&#x2F;87520</a>
评论 #29482112 未加载
评论 #29479238 未加载
评论 #29479197 未加载
评论 #29482720 未加载
igammaraysover 3 years ago
Anyone have deep experience with both Django and Laravel and can offer a comparison of the two?
评论 #29477994 未加载
alberthover 3 years ago
Off topic: I wish NIM had a Django-like web framework.
ilovefoodover 3 years ago
Congratulations on the release!! I&#x27;m looking forward to give it a go and see what&#x27;s new for myself.
unixheroover 3 years ago
Where are we on the whole Django versus Rails debate?<p>(Not cannonfodder, I am genuinely curious)
评论 #29472596 未加载
评论 #29474935 未加载
评论 #29474558 未加载
评论 #29476961 未加载
评论 #29474004 未加载
alanwreathover 3 years ago
Django for me has been a solid API gateway. That said I would appreciate an API-centric iteration of it. Something like how Laravel has Lumen. Even if they would make Django ORM available as a separate library it would make me glad. I can’t say I’m overly enamored by the red wave that has passed over python. The only things I really like it for (so far) are when I wish to make concurrent http calls. For whatever reason, I don’t enjoy it as much when I’m trying to serve multiple requests. I prefer keeping requests read only or at most job launching.
buro9over 3 years ago
Maybe this will be the moment I upgrade.<p>Let&#x27;s see what version I&#x27;m running: Django 1.5.9<p>This is going to be very painful isn&#x27;t it. I wonder how long until the bitrot makes it unbuildable and undeployable.<p>I should clarify, there is no database attached to this and it talks to a secure API that is maintained really well. So this is just views and templates, where the views talk to the API.
midrusover 3 years ago
I&#x27;ve used Django for a long, long time (since 0.96). Django is great for backend stuff, but nowadays for full stack applications (if you&#x27;re not doing an SPA) I find Laravel and Rails a lot better. In particular Laravel&#x27;s templates (blade) and asset handling is awesome.
raihansaputraover 3 years ago
I&#x27;ve always followed Django as Python is my first language and still my &#x27;natural&#x27; way to think about code. The more I look into it, the more I feel like the learning curve is a bit like a camel&#x27;s back. Easy for some stuff. Hard to figure the middle part (usually because not understanding &quot;how&quot; Django really works). And easy at the ends after knowing how you can &quot;mould&quot; Django in certain ways. It feels like a great multitool for the professionals who need to create project after project.<p>I believe the middle part of the learning curve can be easier, but with the &quot;social cruft&quot; of all the Django tutorials out there, it&#x27;s a game of luck to encounter what&#x27;s good and what are the different, sensible, approaches to handling growing&#x2F;big Django apps.<p>What can make this easier is a document&#x2F;discussion of some sort that provides clear, complete, approaches. Here are some aspect that needs to be considered. I believe with the combinations defined, and describing the tradeoffs will be a very great start for any team&#x2F;person looking to jump into Django, or improve their next project.<p>- Postgres seems to be default. SQLite + Litestream is there but still bleeding edge.<p>- Packaging is the hot topic, for sure. Pipenv, poetry, venv, etc?<p>- Traditional Serverside Templating + JS enhancement (HTMX&#x2F;Hotwire&#x2F;etc), or JS based SPA (React, Vue, Angular, Svelte, etc)<p>-- This also includes the asset compiling story (Tailwind JIT, Sass compilation, Babel&#x2F;webpack&#x2F;rollup&#x2F;etc)<p>- Fat models, Fat views, or Service layer? To which extent?<p>- Single app (Doordash) or Multiple apps (Thread with &gt;500 apps)?<p>- What&#x27;s the theoritical limit to using Postgres + Disk&#x2F;Memory Caching (so no external Redis&#x2F;ElasticSearch&#x2F;other services needed)?<p>-- Search, queues&#x2F;async job, scheduled jobs, reports, emails, etc<p>EDIT: A view additional points<p>- Documented limits about using whitenoise to serve static assets, and when &amp; how to move to S3. Also Cloudflare&#x2F;CDN fronting<p>- Cloud storage story (uploading to S3 api from FileField and Rich Text fields, and also async jobs)<p>-- Proxy story to enable &lt;a download&gt; from cloud? (Maybe a bit far, but I think this is a common request)<p>- Deploying&#x2F;Serving optimization (is gunicorn the best option for now? how to scale w&#x2F; regard to vCPU counts to avoid the 25% CPU Max utilization?)<p>- How to debug between inefficient query&#x2F;app code&#x2F;templating&#x2F;serving&#x2F;caching?<p>I&#x27;m sure there are more points, but it would be great if there&#x27;s a documented sensible approaches to evaluate. I know there are templates, but great discussions about the tradeoffs of complete &quot;packages&quot; are rare.
marcus_cemesover 3 years ago
Does anyone know how Python&#x2F;Django compares to something like Elixir&#x2F;Phoenix?
评论 #29477858 未加载
评论 #29477430 未加载
评论 #29474140 未加载
评论 #29474770 未加载
dukeofdoomover 3 years ago
I still have a project that runs on Django 1.6. Can&#x27;t imagine trying to migrate now, when it relies on so many old packages. Would probably be better of starting from scratch.
评论 #29482086 未加载
评论 #29473243 未加载
kolanosover 3 years ago
Feels more like a Django 3.3 release than a 4.0 -- was expecting Django 4.0 to deliver the promised ORM async support.
评论 #29480803 未加载
评论 #29478119 未加载
_tardigradeover 3 years ago
nowadays most people use Django to create REST API. I wish Django would merge DRF into its codebase.
评论 #29475350 未加载
评论 #29472433 未加载
peterth3over 3 years ago
Congrats to the Django team! Adding support for a Redis cache instead of only memcached is awesome.
strzibnyover 3 years ago
Congrats the team on the release.<p>Now I have to go and check what to update for Deployment from Scratch :D
b-leeover 3 years ago
Great to see they have managed to reach their funding target. Donated anyway!
Dowwieover 3 years ago
Is there a possibility of the cache stampede &#x2F; dogpile problem?
naveen_over 3 years ago
Thanks a lot..