Live data from Hacker News

Django 3

docs.djangoproject.com

21–30 of 196 posts

Re: Django 3

#21

Right as I was just about to start a new Django project... The thought going through my mind right now is "I wonder if there is some way of creating a Django project and make it resilient to future Django updates and releases with minimum fuss?" I've had to deal with ongoing and inherited legacy projects which run on Python 2.7, use the long-deprecated Pylons, for which there is no easy upgrade path other than a tota…

I feel your pain. If maintainability is your concern, I would advice to skip this release as it won't have long term support. The current LTS release is still 2.2 and will only be replaced with 3.2 sometime in 2021.

You probably already know, but the long term release timeline is shown at https://www.djangoproject.com/download/

Sticking with LTS releases really helps. You'll still have nearly a year to migrate from one LTS release to the next.

In my experience it also helps to avoid small (e.g. a single developer) and young Django apps and stick to the big ones. The amount and quality of the documentation can also be an indicator of longterm viability of the project.

I've done a few more significant migrations (including Python 2 to 3), and about the only bad things are apps whose development stopped and those with developers implementing hacks using Djangos internal API. Everything else is usually done in less than a day for the whole Django project. I only did small projects with 5-10k loc, though.

Re: Django 3

#22
post #5

Does Python still have performance issues? That's always been my concern when considering its adoption.

I mean, what kind of performance issues were you running into?

You're not going to get maximum performance out of a python program, generally. But unless your python program is using 100% cpu that's not really an issue, and there are very few cases where I'm using python and it's CPU that's slowing down the program. Mostly it ends up being some kind of IO.

If you're looking to do complicated mathematical operations, you can call out to an external library like `numpy` of tensorflow to take better advantage of cpu/gpu compute.

You can also use a faster python interpreter, like `pypy`, although then you start getting slower startup times and more memory usage. The performance is closer to something like java but drawbacks are generally enough that they don't get used, since it's very rare that you need that extra performance.

There's also micropython, which lets you run python on a microcontroller and makes it pretty easy to optimize things for your hardware, although you lose some useful debugging and introspection features.

But for the most part, I haven't run into anything I'd call "performance issues", just the knowledge that python is a scripting language and it's never going to be the fastest thing around. Python's performance just isn't an issue very often.

Re: Django 3

#23
post #18
post #5

Does Python still have performance issues? That's always been my concern when considering its adoption.

Yes. If you can afford the CPU power, by all means go with Python. Otherwise just don't. Instagram can afford it so it works fine for them. Reddit can't, so their site is always slow or down.

I think reddits issues are more related to database IO than cpu time.

Re: Django 3

#24
post #5

Does Python still have performance issues? That's always been my concern when considering its adoption.

I mean, what kind of performance issues were you running into? You're not going to get maximum performance out of a python program, generally. But unless your python program is using 100% cpu that's not really an issue, and there are very few cases where I'm using python and it's CPU that's slowing down the program. Mostly it ends up being some kind of IO. If you're looking to do complicated mathematical operations,…

In my experience most people creating CRUD websites with Django will hit a CPU bottleneck.

Re: Django 3

#25

For those on the 1.11 LTS release, and considering getting off the LTS train, I wonder whether it's a feasible upgrade path to go straight to 3.0, or if it would be smarter to go to 2.2 first.

I suspect it would be far kinder to yourself to first upgrade from 1.11 to 2.2 and get all your tests working and then consider upgrading to 3.0.

Re: Django 3

#26

Right as I was just about to start a new Django project... The thought going through my mind right now is "I wonder if there is some way of creating a Django project and make it resilient to future Django updates and releases with minimum fuss?" I've had to deal with ongoing and inherited legacy projects which run on Python 2.7, use the long-deprecated Pylons, for which there is no easy upgrade path other than a tota…

I work as a contractor and have codebases in python, f#, delphi, swift, obj-c and now rust.

> "I wonder if there is some way of creating a ???? project and make it resilient to future??? updates and releases with minimum fuss?"

- Use control version (mercurial, git, ...) in everything, including utils and side projects.

- Record all dependencies somewhere in the project.

- Automate the builds, so you also have how reconstruct the project

- Use VM or containers or virtual envs or similar

- Rely in a small "core" of solid dependencies (in my case: PostgreSQL, sqlite3, nginx, ubuntu LTS) that could cross across projects and versions.

- Reduce dependencies (but each day is HARDER and HARDER) or better, NOT USE VERY FANCY STUFF (rely on PAAS or kool-aid kind of tech.) For example, If I rely in a http client library it can be dead years after I need to upgrade. That sucks, but, a "http client library" is so "normal" to have that I can rely in found a alternative easily. However, if I base everything on top of Firebase or other cloud stuff, if it die... good luck with that!

Re: Django 3

#27

Groovy. I am excited to try out the new ASGI goodness. Last time I used Django Channels it was a constant struggle to tune it, prevent it from becoming deadlocked, etc. And the transition from Channels 1.x to 2.x was also not pleasant. I hope that Django proper did things better/differently.

Not Groovy, Python! :)

Re: Django 3

#28
post #24

Earlier quoted context omitted.

I mean, what kind of performance issues were you running into? You're not going to get maximum performance out of a python program, generally. But unless your python program is using 100% cpu that's not really an issue, and there are very few cases where I'm using python and it's CPU that's slowing down the program. Mostly it ends up being some kind of IO. If you're looking to do complicated mathematical operations,…

In my experience most people creating CRUD websites with Django will hit a CPU bottleneck.

Would Django going async ease that a bit or not really?

Re: Django 3

#29
post #24

Earlier quoted context omitted.

In my experience most people creating CRUD websites with Django will hit a CPU bottleneck.

Would Django going async ease that a bit or not really?

async doesn't decrease the amount of CPU cycles needed to do work, in any case it only increases it.

Re: Django 3

#30

Right as I was just about to start a new Django project... The thought going through my mind right now is "I wonder if there is some way of creating a Django project and make it resilient to future Django updates and releases with minimum fuss?" I've had to deal with ongoing and inherited legacy projects which run on Python 2.7, use the long-deprecated Pylons, for which there is no easy upgrade path other than a tota…

Perhaps it's time to think about ditching the "batteries included" monolithic frameworks like Django (Rails etc.) and start your serverless/microservices/docker/k8s/etc journey.

The beauty of this type of architecture is that you don't need to worry about upgrading your entire stack just because your underlying framework bumped a version number. You can create a service w/ Pylons here, a service w/ Whatever there, and lock them down without needing to refactor them all just because you want to add another feature.

Post reply on HN