Earlier quoted context omitted.
I'm not sure you're talking about the same thing, this is about asyncio/green threads.
re-read the documentation but I'm not following. This example: async def current_datetime(request): now = datetime.datetime.now() html = ' It is now %s. ' % now return HttpResponse(html) seems like an example that I was thinking of.
Django 3.1
41–50 of 209 posts
Re: Django 3.1
#42Slightly OT: How does HN feel about the recent craze to make web python asynchronous? To me, the performance gains are dubious in many cases and the complexity overhead of handling cooperative multitasking just seems like a step back for a language like python.
10% of the time I'm calling an API that takes 3s and tying up a worker for 3s _might_ be a problem. Being able to not do that would be really handy sometimes.
Not web servers, but I also do a lot of web scraping and Python is definitely the best tool I've used for that job (lxml is fast with great XPath support, Python is very expressive for data manipulation), using async for that could dramatically improve our throughput as it's essentially network bound, and we don't really care about latency that's in the 10s of seconds.
Source: I work on a large production Django site.
Re: Django 3.1
#43Pardon the rant, but I feel that the advantages don't outweigh the fact that with each release some of my stuff gets broken and I need to adjust. Django puts DeprecationWarnings basically everywhere and it's a hell to maintain projects that had been alive for a few years. God forbid you do anything with the interfaces they expose. The problem is only getting worse when you consider your dependencies, which in many ca…
This seems like exactly the way that deprecations should be handled. Are you suggesting they should maintain backwards compatibility for much longer? They already have a pretty long deprecation policy.
Re: Django 3.1
#44Earlier quoted context omitted.
I am good with Python and C#
Then ASP.NET is probably the superior choice. C# is a better language by far and the .NET runtime is a better runtime by far. It only ever makes sense to use Python for data-science one-offs and munging if you have competency in Java/C#/etc. It's not a language well suited to application development.
Re: Django 3.1
#45JSONField has been an absolute godsend in combination with Django's ORM. I had been using it with Postgres and will likely keep our backend the same, but I cannot recommend it enough. You will have to write some validation and schema code on top if you want your data to have similar (but weaker) guarantees to the usual typed fields; the benefits from the flexibility you get are immeasurable though.
Typical use case: There are a number of required fields that your app won't work without. Those should be columns, probably non-nullable columns. Then there're a bunch of optional fields. Traditionally, a number of nullable cols would be created. But they're ultimately messy (need to null check every accesses) and unneeded since you can replace them with a single json item. Keys are always optional, so you always nee…
Re: Django 3.1
#46Earlier quoted context omitted.
I am good with Python and C#
Then ASP.NET is probably the superior choice. C# is a better language by far and the .NET runtime is a better runtime by far. It only ever makes sense to use Python for data-science one-offs and munging if you have competency in Java/C#/etc. It's not a language well suited to application development.
Big nono!!
Re: Django 3.1
#47Earlier quoted context omitted.
Then ASP.NET is probably the superior choice. C# is a better language by far and the .NET runtime is a better runtime by far. It only ever makes sense to use Python for data-science one-offs and munging if you have competency in Java/C#/etc. It's not a language well suited to application development.
Don’t understand why you got downvoted. I work in a Python shop and 100% agree with you.
Re: Django 3.1
#48Earlier quoted context omitted.
Then ASP.NET is probably the superior choice. C# is a better language by far and the .NET runtime is a better runtime by far. It only ever makes sense to use Python for data-science one-offs and munging if you have competency in Java/C#/etc. It's not a language well suited to application development.
Don’t understand why you got downvoted. I work in a Python shop and 100% agree with you.
Threads which start like that rarely end up contributing anything of value or convincing anyone who didn’t already agree with the author.
Re: Django 3.1
#49JSONField has been an absolute godsend in combination with Django's ORM. I had been using it with Postgres and will likely keep our backend the same, but I cannot recommend it enough. You will have to write some validation and schema code on top if you want your data to have similar (but weaker) guarantees to the usual typed fields; the benefits from the flexibility you get are immeasurable though.
In projects I've been involved with, storing JSON in the database has often turned out to be a mistake. Django models create a well-defined self-documenting structure for your schema, are easy to evolve using migrations, and there's a wealth of tooling built on top. IMHO, these far outweigh the perceived convenience of simply storing some stuff in a JSON field. If you find yourself implementing your own validation an…
Re: Django 3.1
#50Earlier quoted context omitted.
I am good with Python and C#
Then ASP.NET is probably the superior choice. C# is a better language by far and the .NET runtime is a better runtime by far. It only ever makes sense to use Python for data-science one-offs and munging if you have competency in Java/C#/etc. It's not a language well suited to application development.