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.
Django 3.2
121–130 of 195 posts
Re: Django 3.2
#122Any one have any pointers to learn the Django stack from the basics? Any specific video course or a book? "Two Scoops of Django" was recommended to me by someone on HN. I think it is currently being worked on for Django 3. It is on my reading list.
Re: Django 3.2
#123Congratulations to the Django project and contributors on a big LTS release. And a huge thank you for the consistently excellent framework that so many have built their web dev careers on. I'll post this as a Show HN soon, but I'll mention it now as a soft-launch introduction. After a decade of using Django I started a project I always wanted to exist: backported security and bug fixes to old versions that the Django…
Btw, might have overlooked, if I'm purchasing for my org, I would like to look at the commercial license. Can you point me to it? Or put it online if not currently available? I'm not using your service at this moment, so feel free to ignore the request as well.
Re: Django 3.2
#124I'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…
Typically the inflection for when Django becomes a nightmare is when you want to start splitting the application up. This is made really hard because Django depends on a whole load of globals (settings, urls, context preprocessors, the actual WSGI handler). With Flask you can have two separately configured applications running in the same process, routed with a bit of WSGI middleware.
This comes in handy when you need to do a 'soft' rewrite and have code running side by side. This also just makes things easier to test, because you can build a new application object for each test with it's own settings. You can't do that in Django with out a great deal of consternation; try creating two tests with different middleware stacks in Django, patching settings won't work because the application has already loaded, and there's no way to reload it between tests.
Also, for the same reason (as someone else said) it makes it tricky to use in non-web contexts. Like Celery.
Django's can't handle more complex database queries. If you've ever seriously used SQLAlchemy, you'll know what you're missing.
The ORM is also lacking a unit of work model, which can kill performance. The only way to create multiple objects in a single database round trip in Django is with `bulk_create`. But you can't create something like a group and then a user in a single database round trip. Sure you can create them in a single transaction, but that's not quite the same, because each roundtrip takes an extra millisecond. It's an easily avoided inefficiency that SQLAlchemy solves.
The template language is limited compared to Jinja2. While this is by design, it doesn't support streaming the response back. This is really annoying if you're generating massive templates. It would have also been really simple to do.
I could go on really.
Re: Django 3.2
#125Congratulations to the Django project and contributors on a big LTS release. And a huge thank you for the consistently excellent framework that so many have built their web dev careers on. I'll post this as a Show HN soon, but I'll mention it now as a soft-launch introduction. After a decade of using Django I started a project I always wanted to exist: backported security and bug fixes to old versions that the Django…
> It's free for personal use and a paid subscription for businesses and organizations. This is awesome.
Re: Django 3.2
#126Any one have any pointers to learn the Django stack from the basics? Any specific video course or a book? "Two Scoops of Django" was recommended to me by someone on HN. I think it is currently being worked on for Django 3. It is on my reading list.
Tango with Django was by far the best resource I've used. Two Scoops is more for people who have a django project already and want to learn best practices of django.
Re: Django 3.2
#127Earlier quoted context omitted.
I think a lot of developers have moved to reactjs calling an api.
Basically doubling the complexity of an app. If you need a fair amount of front end interaction, fair enough, but many apps would be a lot simpler with Django templates and a bit of jQuery.
Both my personal blog and business run on it in production. See my profile for links.
The biggest issue was deploying it since you need python and node. Still a work in progress, and docs are severely lacking.
But I did add a single-click deploy to Heroku:
https://dashboard.heroku.com/new?template=https://github.com...
Re: Django 3.2
#128Earlier quoted context omitted.
The ORM is horrendous.
Can you elaborate? I've been using it for years and it mostly does what I want. It's an ORM and obviously sometimes generates unefficient queries I need to manually amend/refactor but otherwise I don't see any major issues with it? In contrast I've looked at SQLAlchemy with Flask and I couldn't even wrap my head around declaring models (which inherit from the DB connection object if I remember correctly, so potential…
The Django ORM itself is also slow at generating SQL. Recently I was bemused by a query, which took 500us to actually be generated. This wasn't doing anything particular wild, it just had a `select_related` call to an object that had about 50 fields (not great DB design, but beyond my control). The query actually took longer to build than it did to run.
That itself wouldn't be an issue if you could LRU cache the SQL query itself. But you can't, it's Django.
Re: Django 3.2
#129If 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.
This is awesome, thanks for sharing. I maintain a similar boilerplate (graphene + semantic ui). What's your take on Tailwind so far? I've found the lack of a react offering has really slowed me down.
Re: Django 3.2
#130Any one have any pointers to learn the Django stack from the basics? Any specific video course or a book? "Two Scoops of Django" was recommended to me by someone on HN. I think it is currently being worked on for Django 3. It is on my reading list.
After that, to really get to know Django, you'll want to do some "unconventional" things like use a class based view for a page with 3 forms... That should give you the "ah ha" moment.