Live data from Hacker News

What's up Python? Django get background tasks, a new REPL, bye bye gunicorn

bitecode.dev

31–40 of 63 posts

Re: What's up Python? Django get background tasks, a new REPL, bye bye gunicorn

#31
post #11
post #8

What I love about Django is that you can create a Django project with just one file. You can turn a fresh Debian machine into a running Django web app by just doing: apt install -y python3-django apache2 libapache2-mod-wsgi-py3 And then creating the one file Django needs: /var/www/mysite/mysite/wsgi.py: import os import django from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MO…

I don't catch if you are sarcastic or not do you really consider this a lean process in 2024?

You get downvoted but my first thought was similar, I wasn't sure the author was being sarcastic or not, although for a slightly different reason: the whole process, if done more properly, has a few more steps (and of course even more for production) - but on the other hand it might be interesting for someone to know you can skip some and start a smallish app a bit quicker although I'm not a fan of such hacks.

Re: What's up Python? Django get background tasks, a new REPL, bye bye gunicorn

#32
post #18

Earlier quoted context omitted.

This is one of the core criticisms of Django and python web backends. WSGI is old tech that in your example requires extra packages and code in project to work. By now Python should stand on its own and handle this independently, being proxied to by better http servers like nginx or caddy.

Not only extra packages. They are currently shoehorning extended multiple interpreter support into CPython, which only Django uses. Similarly, the thread support appears to be mainly for the benefit of that famous photo sharing website that uses Django. CPython is fully commercialized.

As someone that doesn't work for the photo-sharing website, I love the new multiple interpreter stuff (it does feel a bit redundant now that the gilemtomy is going forward though, but who knows, maybe more cool uses will become apparent with time (and even so, it is making cpython-the-implementation clean up some of its ugly c-isms that it never bothered fixing, so it's a net win imo even if the feature itself ends up being not-useful)) and the gil-removal. As soon as the gil is gone I'm going to be experimenting with some new optimization projects at work, whole new flows that just weren't viable before under multiprocessing now suddenly are. (whether it all works out for us at that point is anyone's guess, but it's now our problem and not the languages', so yay!)

And I'm certainly not unique amongst other pythonistas, this has been a goal for literal decades.

Re: What's up Python? Django get background tasks, a new REPL, bye bye gunicorn

#33
post #8

What I love about Django is that you can create a Django project with just one file. You can turn a fresh Debian machine into a running Django web app by just doing: apt install -y python3-django apache2 libapache2-mod-wsgi-py3 And then creating the one file Django needs: /var/www/mysite/mysite/wsgi.py: import os import django from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MO…

This is one of the core criticisms of Django and python web backends. WSGI is old tech that in your example requires extra packages and code in project to work. By now Python should stand on its own and handle this independently, being proxied to by better http servers like nginx or caddy.

Django supports ASGI: https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/

Re: What's up Python? Django get background tasks, a new REPL, bye bye gunicorn

#34

Earlier quoted context omitted.

This is one of the core criticisms of Django and python web backends. WSGI is old tech that in your example requires extra packages and code in project to work. By now Python should stand on its own and handle this independently, being proxied to by better http servers like nginx or caddy.

You have to install software for software to run on your computer?!?

You have to install extra software that should’ve been part of std, big difference.

Re: What's up Python? Django get background tasks, a new REPL, bye bye gunicorn

#35

Love Django, but the issue we’ve had with tasks isn’t with performance, scalability, or devex - it’s with operations. Django-tasks afaict has the same issues as Celery/others in that there’s no Django Admin-like tool that reliably allows you to manage task execution, specifically failures. Without this, I can’t use async tasks for anything that’s important to the business or data consistency generally - which means I…

Second this. I’m amazed by the lack of any Django admin interface to start a task or see how it failed, it seems like such an obvious use case. I’ve tried Celery Flower but I found it lacking. I’m surprised because it seems like such a common use case, and given the size of the Django community I would’ve expected something to exist…

Re: What's up Python? Django get background tasks, a new REPL, bye bye gunicorn

#36
post #12

Oh man, I wish this was a bit more mature. I am writing a distributed image processing app right now with Celery, Flask, and SQLAlchemy, but I am finding it difficult to KISS. I was tempted to use Django but couldn't justify the overhead. If they get this cleaned up in the next year that would be awesome!

justify the overhead? But you are using flask and sqlalchemy? You made the wrong choice I would guess. Django does not have 'overhead' to justify in that scenario.

By overhead I didn't mean performance, just all of the extra configuration stuff that comes with Django. Although I'm still open to moving to Django as this project grows. A big benefit of a framework like Django is that everything is already organized for you, I kind of feel like I am re-inventing the wheel a bit here.

I am keeping the business logic separated out though so I can easily move to Django if needed.

Re: What's up Python? Django get background tasks, a new REPL, bye bye gunicorn

#37

Oh man, I wish this was a bit more mature. I am writing a distributed image processing app right now with Celery, Flask, and SQLAlchemy, but I am finding it difficult to KISS. I was tempted to use Django but couldn't justify the overhead. If they get this cleaned up in the next year that would be awesome!

One thing I have learned after nearly a decade in the industry is that you should just never, ever, ever use `celery`. It's overly complicated to program with; the monitoring tools are not great; and the one guarantee you can make is that at some point, you will have some kind of difficult to debug, mysterious failure involving it. If I needed asynchronous background processing in Python today, I'd definitely be look…

Does Django-tasks support different workers with different environments? Say I need a worker with GPU capabilities, can it do that?

Re: What's up Python? Django get background tasks, a new REPL, bye bye gunicorn

#38
post #8

What I love about Django is that you can create a Django project with just one file. You can turn a fresh Debian machine into a running Django web app by just doing: apt install -y python3-django apache2 libapache2-mod-wsgi-py3 And then creating the one file Django needs: /var/www/mysite/mysite/wsgi.py: import os import django from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MO…

Yes but how do you go about defining an ORM model without an app init class?

Re: What's up Python? Django get background tasks, a new REPL, bye bye gunicorn

#40
post #8

What I love about Django is that you can create a Django project with just one file. You can turn a fresh Debian machine into a running Django web app by just doing: apt install -y python3-django apache2 libapache2-mod-wsgi-py3 And then creating the one file Django needs: /var/www/mysite/mysite/wsgi.py: import os import django from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MO…

There is like 10 python frameworks which achieve that with much fewer steps.
Post reply on HN