Live data from Hacker News

Django 3.2

djangoproject.com

151–160 of 195 posts

Re: Django 3.2

#151

A couple thoughts on django as a long time user. First, the good: - Django was the first framework i learned when learning to code. It's documentation was amazing, and it made conceptualizing an MVC framework really easy. - Django's ORM is phenomenal for managing migrations of a relational database, especially postgres with stuff like jsonb. I've even included it in non-python projects, just to handle table migration…

How productive are you with FastAPI compared to Django? I’m thinking of things like forms, error handling and all the other extra stuff that comes with decoupling the frontend and backend.

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.

Re: Django 3.2

#152
post #112

Earlier quoted context omitted.

I've found the Django ORM to be, in my own opinion, one of the easiest ORMs to hit the ground running with. What was the confusing aspect of updating relational data for you?

Creating relationships was not a problem but for example, adding new fields to an already created many-2-many was an issue. Changing migration scripts was also a hassle.

I have run into this exact problem. A many-to-many table had a business meaning, not just an "invisible" relationship. We wanted to put a model in front of it & add soft deletes and created-at/updated-at fields, at it was a mess of hoops and hacks to jump through.

Re: Django 3.2

#153

A couple thoughts on django as a long time user. First, the good: - Django was the first framework i learned when learning to code. It's documentation was amazing, and it made conceptualizing an MVC framework really easy. - Django's ORM is phenomenal for managing migrations of a relational database, especially postgres with stuff like jsonb. I've even included it in non-python projects, just to handle table migration…

>- It doesn't play nicely with a lot of the rest of the python ecosystem. Want to swap in SQLAlchemy? Sorry, no dice.

Being extremely opinionated about stuff like ORM and admin is partly how it developed such a rich ecosystem of plugins. Those plugins exist because they can build upon those foundations.

Flask, by dint of being unopinionated doesn't have solid foundations that its plugins can build upon. This is why you get stuff like quokka (a flask cms plugin built on mongo) while other stuff assumes sqlalchemy and other plugins built plugins for various different storage backends.

Re: Django 3.2

#154
I've been using Django since 2010, I recently hit a roadblock with it that forced me to switch to Go for one of my projects. That's to say, it's not for everything. Especially may not be suitable for advanced SaaS services.

Re: Django 3.2

#155
post #126

Earlier quoted context omitted.

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.

The latest version of Tango with Django is from 2019 and is compatable with Danjango 2.2. Has a lot changed since then, if one was to work with 3.2?

My website was built in the 1.x version days and I don't think there have been any material breaking changes. My website is moderate in complexity... authentication, database, forms, file uploads, email, language support.

Re: Django 3.2

#156

Earlier quoted context omitted.

Interesting. How does dokku work with regards to mixed multi-hosting (Apache virtual hosting) on a server? For example, you have five sites, three are PHP and two are Django. Can it deal with that? Also a neat "for free" feature of CPanel hosting is that you get super easy email hosting. This can save a lot of money for small and medium businesses. While some would be interested in using Django on these systems, it i…

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 internal stuff we use Django for everything. Host it locally, etc. We even use Django as the front end for industrial automation applications (which imposes interesting challenges, like maintaining state in the database as well as reliable activity logs and more).

If I were to summarize the difference between doing Django for the web vs. PHP for a business it would go something like this:

PHP: Get almost any server. Setup the domain, emails, setup database, upload code. You are up.

For Django you could do this (some of this is dated, just making a point):

https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django...

or this:

https://www.gjlondon.com/uncategorized/the-idiomatic-guide-t...

or this:

http://www.robgolding.com/blog/2011/11/12/django-in-producti...

or this:

https://developer.mozilla.org/en-US/docs/Learn/Server-side/D...

In other words, you are way past the beauty and simplicity you got during local development.

And, of course, for most, if not all, of the above, you still have to deal with setting-up business email. Which means you either get the same VPS you got for the PHP case and point the MX record that way or, spend a bunch of money per email address with something like Gmail. Etc.

Django is fantastic. Somehow, someone needs to figure out how to be able to launch the same type of site you might develop locally to a standard VPS just as easily as what is possible on your local development system. Yes, of course, for more advanced sites you are into separate DB, static, application, etc. servers. That's a different use case. I think what people are saying is that there's a great divide between "runserver" and actually being on a server from there without paying more for specialized deployment services.

Another way to look at this that Wordpress will never be challenged at scale if a better tool like Django isn't easily accessible to developers who are not Linux/server experts. I was running Unix before Linux came out and have used Linux in various forms (including early embedded systems applications) since the beginning. If someone like me recoils at the idea of actually deploying Django in the real world I can't imagine what this might feel like to others who might lack the experience.

In other words, I can do the work. I just think it's unnecessarily complex and not enough effort has been expended duplicating the ease of local development for basic to mid-range Django apps at the production server level.

Re: Django 3.2

#157

Earlier quoted context omitted.

Creating relationships was not a problem but for example, adding new fields to an already created many-2-many was an issue. Changing migration scripts was also a hassle.

I have run into this exact problem. A many-to-many table had a business meaning, not just an "invisible" relationship. We wanted to put a model in front of it & add soft deletes and created-at/updated-at fields, at it was a mess of hoops and hacks to jump through.

Does this go easier in any other ORM/DBs that you might have used? Sounds like the semantics of the real-world stuff didn't quite match up to the DB semantics.

Re: Django 3.2

#159

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…

What a great idea. We’ll be subscribing as soon as the 1.11 support is released.

Re: Django 3.2

#160
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…

How big is the smallest Django project after you add proper authentication (signup, login, pw reset, oauth2, 2FA)? Last I checked it was rather terrible.
Post reply on HN