Live data from Hacker News

Django 3.2

djangoproject.com

81–90 of 195 posts

Re: Django 3.2

#81
post #51

Before Django the gold standard for Python web apps was Zope. What a tremendous achievement by the Django team!

I recall there being some 'wilderness years' between people generally deciding that Zope was a bad idea and Django 'winning'. I remember using frameworks like Turbogears and CherryPy for a while before Django and Flask split the 'market' between them.

This is how I was seeing things play out in the early 2000's: — Python Programmers: why do we still have to be doing this in php/Perl/JSP/ASP when Python exists? — The World: here's Zope — Python Programmers: is that supposed to be joke?

Then in 2003 WSGI showed up and it was a matter of time, leading to the years of wilderness that you describe until Django won out. I confess that I was more team Pylons, but happily conceded.

Re: Django 3.2

#82

What ever happened to the Async ORM? I thought that was originally supposed to be part of Django's 3.2 as part of their Async roll out.

I think if that was ever said by a core member, it was stated as a goal, not a for sure thing. I believe I've only ever heard it as speculation / wishful thinking.

Re: Django 3.2

#83
It's a shame that Django's templates are still so bad.

You can't just import and call some arbitrary python function. You most likely need to write a template filter or tag [0]. Maybe there's a good reason for this but it just feels like I'm working around a weird issue in the framework.

Also, I can't use parentheses inside if statements in a template. It's a strange restriction.

I know that Jinja2 -- which is good -- is supported. But it's a second choice, requires some setup and it's not the usual way of doing things.

Don't get me wrong. I like Django and it's still far, far ahead of most other web frameworks. But, because of these issues and also because the frontend story in Django is not that great I find myself reaching for Rails, these days.

[0] https://docs.djangoproject.com/en/3.1/howto/custom-template-...

Re: Django 3.2

#84
post #83

It's a shame that Django's templates are still so bad. You can't just import and call some arbitrary python function. You most likely need to write a template filter or tag [0]. Maybe there's a good reason for this but it just feels like I'm working around a weird issue in the framework. Also, I can't use parentheses inside if statements in a template. It's a strange restriction. I know that Jinja2 -- which is good -…

I think a lot of developers have moved to reactjs calling an api.

Re: Django 3.2

#85
post #83

It's a shame that Django's templates are still so bad. You can't just import and call some arbitrary python function. You most likely need to write a template filter or tag [0]. Maybe there's a good reason for this but it just feels like I'm working around a weird issue in the framework. Also, I can't use parentheses inside if statements in a template. It's a strange restriction. I know that Jinja2 -- which is good -…

It is in fact deliberate, though; the "Philosophy" section on https://docs.djangoproject.com/en/3.1/ref/templates/language... explains it: "If you have a background in programming, or if you’re used to languages which mix programming code directly into HTML, you’ll want to bear in mind that the Django template system is not simply Python embedded into HTML. This is by design: the template system is meant to express presentation, not program logic."

Re: Django 3.2

#86
post #83

It's a shame that Django's templates are still so bad. You can't just import and call some arbitrary python function. You most likely need to write a template filter or tag [0]. Maybe there's a good reason for this but it just feels like I'm working around a weird issue in the framework. Also, I can't use parentheses inside if statements in a template. It's a strange restriction. I know that Jinja2 -- which is good -…

It is in fact deliberate, though; the "Philosophy" section on https://docs.djangoproject.com/en/3.1/ref/templates/language... explains it: "If you have a background in programming, or if you’re used to languages which mix programming code directly into HTML, you’ll want to bear in mind that the Django template system is not simply Python embedded into HTML. This is by design: the template system is meant to express p…

That's something I think most developers would agree with, I certainly do.

Still, I don't think what I mentioned is unreasonable or goes against the framework's philosophy. The templating system already has plenty of logical statements, might as well make it work like expected.

See also Jinja2's take on that https://jinja.palletsprojects.com/en/2.11.x/faq/#isn-t-it-a-...

Re: Django 3.2

#87
post #83

It's a shame that Django's templates are still so bad. You can't just import and call some arbitrary python function. You most likely need to write a template filter or tag [0]. Maybe there's a good reason for this but it just feels like I'm working around a weird issue in the framework. Also, I can't use parentheses inside if statements in a template. It's a strange restriction. I know that Jinja2 -- which is good -…

It is in fact deliberate, though; the "Philosophy" section on https://docs.djangoproject.com/en/3.1/ref/templates/language... explains it: "If you have a background in programming, or if you’re used to languages which mix programming code directly into HTML, you’ll want to bear in mind that the Django template system is not simply Python embedded into HTML. This is by design: the template system is meant to express p…

The way I've seen this play out in reality is that a lot of the "presentational logic" required by the templates gets computed in the "Django Views" layer (akin to the "controller" layer in traditional MVC). So in the end Django views both perform business/service logic and presentational logic.

I took it for granted after doing Django for several years but after doing a lot of web development in a more explicit MVC paradigm (Elixir and Phoenix in this case), my old Django code didn't really separate the web layer from the business logic layer. If I write more Django in the future I'll definitely be more aware of this but in many cases the framework (Templates, Forms, Models, Django-apps) don't really encourage this type of in-app architecture.

Re: Django 3.2

#88
post #83

It's a shame that Django's templates are still so bad. You can't just import and call some arbitrary python function. You most likely need to write a template filter or tag [0]. Maybe there's a good reason for this but it just feels like I'm working around a weird issue in the framework. Also, I can't use parentheses inside if statements in a template. It's a strange restriction. I know that Jinja2 -- which is good -…

Jinja is just as bad. They’re both a pain to extend.

I believe firmly in separation of concerns but I have never understood the stubborn stance that there should be little to no logic inside of the template layer.

ERB does it right. I have seen some heinous things there, don't get me wrong, but the freedom to use any part of Ruby is incredible.

Nothing worse than when a client is hoping for a 1 hour fix on a really benign and silly bug - only to find that you'll need most of that time to whip up a custom template filter or tag, jumping through hoops to do all that.

Re: Django 3.2

#89
post #32
post #17

If anyone is curious I just updated my Docker / Django starter project to use 3.2. It uses Docker Compose + Django + Celery + PostgreSQL + Redis + Webpack + TailwindCSS and it's available at: https://github.com/nickjj/docker-django-example As an aside it's also using TailwindCSS 2.1 with the JIT compiler enabled.

Just upgraded my side project to both Django 3.2 and Tailwind 2.1 (with Jit enabled). No issues at all, other than some deprecation warnings on some 3rd party packages that will probably be fixed soon.

Looks really good. What made you choose Tailwind over the alternatives?

Re: Django 3.2

#90
post #54

I'm more if a flask man myself. Worked with django only when I had to. Maybe I'm wrong?

Honestly, I don't see the point of using Flask anymore. You can set up a Django project and just use a single module with a bunch of view functions, built-in testing and sensible defaults. Done. Not choosing that approach just because it takes a few more MBs on disk or needs a few more KBs of memory is shortsighted, IMO. You can't always predict what a project will end up needing. I'm legitimately asking: why would y…

> I'm legitimately asking: why would you use Flask instead of Django, even if you don't (but might) need the ORM, admin etc.?

If for some reason you wanted to use a noSQL database, Django's ORM and everything connected to it (like admin) won't work.

Post reply on HN