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 3.1

341 pointsby gingerjoosalmost 5 years ago

15 comments

grenoirealmost 5 years ago
JSONField has been an absolute godsend in combination with Django's ORM. I had been using it with Postgres and will likely keep our backend the same, but I cannot recommend it enough. You will have to write some validation and schema code on top if you want your data to have similar (but weaker) guarantees to the usual typed fields; the benefits from the flexibility you get are immeasurable though.
评论 #24048427 未加载
评论 #24049809 未加载
评论 #24048908 未加载
评论 #24049794 未加载
评论 #24048245 未加载
评论 #24050610 未加载
评论 #24048606 未加载
sammorrowdrumsalmost 5 years ago
I&#x27;m surprised the discussion has derailed into whether or not to use JSON fields... Certainly you don&#x27;t have to, but they&#x27;ve been in Postgres contrib for a long time.<p>Async views have dropped, and that is genuinely exciting. It&#x27;s taken a lot of work, and there&#x27;s still a ways to go before Django is truly async native, but this is one of the big steps, and being able to do some concurrent IO on a few routes could be a huge saving for some projects that call out.<p>Otherwise a lot of stuff has to be done in event queues, to avoid blocking the main thread, and sometimes that means a bad UX when users take actions and aren&#x27;t offered the guarantee that they are complete - in times where that might be the best option, were you not risking blocking thread.
评论 #24051525 未加载
评论 #24051553 未加载
jungletimealmost 5 years ago
As someone that has an active app still written in Django 1.6. The larger my project and more complicate the more I wanted to ditch the model&#x2F;view&#x2F;template separation. And attach methods to the model so that it can be called from everywhere, returning html code in a string directly.<p>Other times, I wished Django had something analogous to a component, where everything is just encapsulated in a single file. I don&#x27;t want to separate javascript&#x2F;html&#x2F;css view&#x2F;template. I want a single file I need to update and an easy way to call to render.<p>The template system is also difficult to use, if you get complicated scenarios.<p>I needed to show event details in a modal if that was the user preference. But the page could also be embedded. This lead to me having to render differently depending on the device, whether it was embedded and if it was a popup or not. This lead to an explosion of possibilities, a total 2x2x2 = 8 different views for the same data in the same template.<p>The most practical way was with if &#x2F; then statements but that still lead to me repeating html code. And being difficult to reason about and test.<p>I also got into situation where the template wasn&#x27;t parsed and updated. Probably because of too many includes or inheritance in the template. For example, I wanted to write a custom css file that would use google fonts that the user selected in the UI. The only way I found to work was to bypass the template and write a function in the view that would render_to_string the css file.
评论 #24052552 未加载
评论 #24055821 未加载
scrollawayalmost 5 years ago
I&#x27;ve been using 3.1 alpha&#x2F;beta for a while and it&#x27;s got some pretty nice improvements. &quot;JSONField for all databases&quot; is a huge deal IMO, as it simplifies a lot of fairly common use cases.
Jonnaxalmost 5 years ago
Cool, they&#x27;ve implemented async views.<p>ASGI has kinda passed me by. For some small project&#x27;s I use Gunicorn.<p>What&#x27;s the setup for ASGI that&#x27;s popular?
评论 #24048331 未加载
评论 #24049244 未加载
评论 #24048372 未加载
评论 #24050285 未加载
评论 #24050243 未加载
d33almost 5 years ago
Pardon the rant, but I feel that the advantages don&#x27;t outweigh the fact that with each release some of my stuff gets broken and I need to adjust. Django puts DeprecationWarnings basically everywhere and it&#x27;s a hell to maintain projects that had been alive for a few years. God forbid you do anything with the interfaces they expose. The problem is only getting worse when you consider your dependencies, which in many cases don&#x27;t keep up with the release cycle of Django. It&#x27;s a mess.
评论 #24048333 未加载
评论 #24051893 未加载
评论 #24048246 未加载
评论 #24048637 未加载
评论 #24048315 未加载
评论 #24051220 未加载
评论 #24051753 未加载
评论 #24055871 未加载
konschubertalmost 5 years ago
Slightly OT:<p>How does HN feel about the recent craze to make web python asynchronous?<p>To me, the performance gains are dubious in many cases and the complexity overhead of handling cooperative multitasking just seems like a step back for a language like python.
评论 #24048375 未加载
评论 #24049008 未加载
评论 #24048243 未加载
评论 #24048632 未加载
评论 #24048822 未加载
评论 #24048250 未加载
评论 #24048219 未加载
评论 #24049491 未加载
评论 #24060161 未加载
评论 #24050162 未加载
leetroutalmost 5 years ago
I hope they prioritize some support for ROLLUP and friends.<p>I’d never used it before and it was fantastic but I had to drop down to raw sql to do it. SQLAlchemy has had support for well beyond a year.<p>I’ve used Django since 2008 and I love it with all its warts but I’ve really grown to prefer SQLAlchemy.
评论 #24049481 未加载
评论 #24054053 未加载
kumarvvralmost 5 years ago
OT Question : When choosing a stack for creating sites, would you choose Django over ASP.NET Core or PHP?<p>If so, why?
评论 #24049157 未加载
评论 #24050257 未加载
评论 #24048717 未加载
评论 #24050558 未加载
评论 #24048403 未加载
评论 #24052068 未加载
评论 #24051421 未加载
评论 #24048540 未加载
评论 #24050018 未加载
评论 #24048386 未加载
评论 #24050303 未加载
评论 #24048322 未加载
jungletimealmost 5 years ago
Something I wish that Django did was user defined functions in the template. It has for loops, which is good but it forces you to write the html in top to bottom procedural manner.<p>It would be far better to be able to define a function that you can call for bits of html code that might repeat in the same template.<p>Since I stopped using Django at 1.6 does the new version let you define functions in the templates?
评论 #24052417 未加载
评论 #24054154 未加载
评论 #24052508 未加载
jtdevalmost 5 years ago
Does the ORM still write horrendous cursor based loops where simple joins would suffice?
评论 #24049442 未加载
waihtisalmost 5 years ago
I&#x27;m closer to a hobbyist than a professional dev, but the async views seem like a big functionality. Having done some Django apps, getting a synced up view for some changing variable was always a bit painful.
评论 #24048457 未加载
FreeHugsalmost 5 years ago
What would be a typical use case for &quot;Asynchronous views&quot;?
评论 #24048795 未加载
评论 #24049895 未加载
评论 #24048732 未加载
评论 #24050618 未加载
ram_raralmost 5 years ago
I wish, there is something equivalent like this in golang world. Django has been one of the best well maintained open source projects.
samirsdalmost 5 years ago
can the async functionality replace celery?
评论 #24059483 未加载