This looks neat. Does anyone have experience with using type hints and mypy with Django? Any gotchas?
Django 3
31–40 of 196 posts
Re: Django 3
#32Groovy. 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.
Re: Django 3
#33This looks neat. Does anyone have experience with using type hints and mypy with Django? Any gotchas?
Re: Django 3
#34This looks neat. Does anyone have experience with using type hints and mypy with Django? Any gotchas?
Ran into a couple issues with the typing of ‘client.force_login()’ where the ‘user’ parameter was typed as the ‘get_django_user()’ which wasn’t the same as the custom user model I defined in the ‘models.py’. I also had issues with ‘from django.conf import settings’ not being the correct type so I’d suggest changing that to ‘Any’.
You might be able to override the few types that don’t work for your given setup or you can just fork the repo.
Overall, I think the pain is worth the benefits.
Re: Django 3
#35Right 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, an…
Edit to add: I would class an advantage of microservices if it made it easier for you to have automated tests or deployment/rollbacks, since that’s much more effective for this problem in my experience. I’ve seen people do that with monoliths and fail to do that with microservices so again, no magic wands.
Re: Django 3
#36Earlier 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.
You have to work pretty hard to hit a CPU bottleneck, and I can't imagine how you'd do that building a simple CRUD website.
Can you explain a bit more about how the people you know are hitting that bottleneck? I mean I've literally built CRUD apps on an esp32 microcontroller using python, and they work performantly. If real python with a real web-framework can't do the same then something is going horrible wrong.
Re: Django 3
#37Groovy. 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.
Re: Django 3
#38If Django can now also support annotations and async code I dream of an scenario where apis can be built using this two elements.
Does anybody know a good resource to learn/catch up with this release?
Re: Django 3
#39You also gain access to new features as they come out, this way.
Re: Django 3
#40Groovy. 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! :)