Live data from Hacker News

Django 3.2

djangoproject.com

171–180 of 195 posts

Re: Django 3.2

#171

Earlier quoted context omitted.

The main thing I would wonder about is if there's a good auth plugin for FastAPI. I am not a huge fan of Django, but if you have already chosen Python, it is really hard to argue with having good, battle-tested auth system out of the box.

The other side of the coin is that django's auth system is pretty rigid. Adding additional fields to the user object is clunky, and trying to do an unusual auth flow can be downright ugly. Dealing with that a few times can leave you a lot more open to designing your own and/or patching together other libraries. At least, that's how it went for me a few years ago.

Django allauth handles 90% of auth needs. Adding fields to user is easy if you set it up correctly

Re: Django 3.2

#172
post #90
post #54

Earlier quoted context omitted.

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.

There are connectors for noSQL databases as well. Or it's surely easier to implement one than to reimplement everything else around the ORM.

Re: Django 3.2

#173
post #54

Earlier quoted context omitted.

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…

Because Django is pretty badly designed, and it can get in the way when you need to do some more complex stuff. It get's the job done for 95% of cases, but that extra 5% can devolve into some pretty nasty stuff. 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,…

You can use whatever ORM or templating library you want. But at least if one day you realize you need something that Django offers out of the box it's there for you to use.

And if not it's not like it has any perceivable effect on performance.

Re: Django 3.2

#174
post #41

Earlier quoted context omitted.

I generally agree philosophically but PHP has a couple of features which make problems more likely: the C style error handling increases the odds of problems being ignored (yes, Python can have except:pass but that’s more obvious & requires intent) and the mushy typing hits even experienced developers who didn’t think about whether they needed === instead of ==. The standard library’s inconsistent parameter ordering…

I think the tooling we have in the Python ecosystem far exceeds PHP and I agree (and mentioned below) about the inconsistencies. Been a long time since our chats at DC Python. Hope you’ve been doing well, sir!

Heh, yes, it has been quite a while. Pandemic pre-K has been quite the adventure so DC Python seems like a fairly distant memory ;-)

Re: Django 3.2

#175

Earlier quoted context omitted.

A couple of years ago(2014) I made my first Python website and really enjoyed, however when it was time to put it onlin I quickly discovered that setting up hosting and configuring it was as large a task in getting to know pip, env, unicorn, apache2 and a plethora of other software to host it, is this still the case? Becaue this is what keeps me of hosting websites with python.

I was in a similar position a few years ago too, until I forced myself to learn Docker. Now, all my projects are started from the same building blocks: Docker + Django + Gunicorn + Nginx + Postgres. And I love it. Now I have traefic at the top of My to-learn list so that I can host multiple projects in the same VPS. Last weekend I learned to use 11ty — the first static site generator I managed to grasp — and I'll ent…

> Now I have traefic at the top of My to-learn list so that I can host multiple projects in the same VPS.

Why do you need that? Nginx dispatches based on the domain name so you can easily host multiple Django sites on the same vps. I use the same tech stack as you except with uwsgi instead of Gunicorn.

Re: Django 3.2

#176

Earlier quoted context omitted.

Dokku will allow you to host multiple applications on subdomains for which you can create CNAMEs in your DNS settings. Dokku is more of a mini self hosted Heroku without a dashboard so you'll lose out on cpanel features like email hosting. But If you're not uncomfortable using docker, you can check out Cloudron [0] which handles email [1] and gives you access to quite a few web apps you can easily install on your ser…

BTW, it's not that I am not confortable with Docker. In fact, we use it for development. This is more about time and resources. I run more than one business and a couple of them have more than one domain. We pay for a decent VPS and can host and manage as many email addresses and applications as we want. Yet we have to limit it to PHP (either pure PHP or something like Wordpress). And, BTW, I hate using PHP. For inte…

That's true. Every time I have to launch a new Django site I always have to spend an hour or two reading docs to refresh my memory on how to configure everything. SSL, systemd services, certificates, uwsgi, database setup, permissions, dns, email, etc. Someone could probably make a lot of money by creating some kind of Django+uwsgi+docker+nginx+postgreSQL bundle to make this process as painless as possible.

Re: Django 3.2

#177

Congratulations 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…

This is so cool, I’m really glad to see someone doing this. Best of luck!

Cheers, that means a lot. Thanks for starting something truly great all those years ago!

Re: Django 3.2

#178
post #12

Earlier quoted context omitted.

Depends what you want to do, and why you're doing it. Very often when I make something in Flask, I end up with so many dependencies it might as well be Django (but without the cohesion). On the other hand, Django might be overkill in some situations (e.g. a small API without a relational database backend).

I think one common misconception is that Django can't be used in place of Flask when you want a minimalist set up. And to be fair, I used to think the same until I read Lightweight Django [0]. Their smallest django project code is just a couple of lines: import sys from django.conf import settings settings.configure( DEBUG=True, SECRET_KEY='thisisthesecretkey', ROOT_URLCONF=__name__, MIDDLEWARE_CLASSES=( 'django.midd…

I think the comparison is not so much lines of code but conceptual overhead. With Flask you create an app instance and call @app.route() with some Python functions and run the app. Granted it's probably not going to do much, and by the time you build out a real-world application with a SQL database, authentication and so forth you're going to get diminishing returns, but for a beginner who just wants to know "how do I make a web page using Python?" it's great.

Re: Django 3.2

#179
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.

I went back to this thread to find the docker-django-example. I have to say, this is really solid work, and thank you for sharing it. Tailwind is commercial I see, is there a free way to get set up with a nice looking "dashboard + sidebar" UI without buying the Tailwind UI?

Re: Django 3.2

#180
post #179
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.

I went back to this thread to find the docker-django-example. I have to say, this is really solid work, and thank you for sharing it. Tailwind is commercial I see, is there a free way to get set up with a nice looking "dashboard + sidebar" UI without buying the Tailwind UI?

Thanks.

TailwindCSS is open source and free. It's at https://tailwindcss.com/.

TailwindUI is an optional paid product that has a bunch of pre-made TailwindCSS components created by the makers of TailwindCSS. Basically pre-made widgets and layouts.

TailwindUI has a few free components too (no signups required) at https://tailwindui.com/preview.

And if you Google around for Tailwind components and themes you'll be able to find a bunch. It's just CSS at the end of the day so there's lots of community driven examples. For example here's a bunch of free ones at https://tailwindcomponents.com/components, https://www.tailwindtoolbox.com/starter-templates and more at https://github.com/aniftyco/awesome-tailwindcss#ui-libraries....

Post reply on HN