Live data from Hacker News

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

bitecode.dev

11–20 of 63 posts

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

#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?

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

#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.

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

#13
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?

[flagged]

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

#14
Quart, the ASGI version of Flask, also has background tasks, https://quart.palletsprojects.com/en/latest/how_to_guides/ba..., and there is an extension Quart-Tasks, https://github.com/pgjones/quart-tasks, to run them on a schedule. Via

    @tasks.cron("*/5 * * * *")  # every 5 minutes
    async def infrequent_task():
        ...
In addition Hypercorn, https://github.com/pgjones/hypercorn, (a ASGI and WSGI) also does not use gunicorn, having migrated many years ago.

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

#15

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 looking into `django-tasks.` If you asked me yesterday, I'd have told you I'd use SQS / whatever the platform equivalent was, or, failing that, I'd probably go with `dramatiq`.

Edit: LOL, I can't believe I forgot to mention what a fscking nightmare `celery` is to deploy and configure. UGH.

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

#16
Background tasks look well thought out, looking forward to try that.

Despite being somewhat out of fashion, Python and Django continue to serve more down to earth software development well after so many years. I picked it up around 2007 (remember the "magic removal" branch), and it only got better ever since. Many call Python "toy language" or "data scientist language" but the truth is that 99.9% of modern web development is database-backed and, unless you have some strictly computational tasks behind your APIs, the fact that e.g. Rust is 100x "faster" than Python is mostly meaningless. Django just works. Of course, there can be different personal preferences, but I'm really amazed by the project that is closing in on 20 years that is still absolutely relevant and a joy to work with.

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

#17
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.

> This is one of the core criticisms of Django and python web backends.

No it's not. Please cite reputable sources.

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

#18
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.

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.

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

#19

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.

> This is one of the core criticisms of Django and python web backends. No it's not. Please cite reputable sources.

One does not need to cite a source of criticism, it is in itself the criticism.

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

#20

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…

Which django-tasks? This one that started development a month ago?

https://github.com/RealOrangeOne/django-tasks

Post reply on HN