Live data from Hacker News

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

bitecode.dev

21–30 of 63 posts

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

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

Here's how much is installed when you do `pip install django` currently:

    122370  django          python=103934,javascript=18407,xml=29
    2734    sqlparse        python=2734
    1110    asgiref         python=1110
This will probably change when `django-tasks` gets merged in.

Here's what installing `flask` + `sqlalchemy` pulls in:

    141314  sqlalchemy      python=141314
    11464   werkzeug        python=11159,javascript=305
    8934    greenlet        cpp=4993,python=2729,ansic=1092,asm=120
    8606    jinja2          python=8606
    5842    click           python=5842
    3907    flask           python=3907
    2036    top_dir         python=2036
    644     itsdangerous    python=644
    487     markupsafe      ansic=278,python=209
    349     blinker         python=349

Looks like the same order of magnitude to me, which is surprising. I had always thought of `django` as being heavy weight and opinionated, while `flask` + `sqlalchemy` was light and modular.

All numbers generated using David A. Wheeler's 'SLOCCount'. :-)

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

#22

Earlier quoted context omitted.

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

The very same. As mentioned in the article, it's going to be distributed with the newest version of Django.

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

#24
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 don’t use it at all, favoring “normal” queuing backends.

Is Django-tasks the solution that would permit this to be built?

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

#25
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…

Blown away this is possible. When I was starting to learn to code and was overwhelmed when learning all the bits and pieces of rails, I wondered if everything necessary to run a very small app could be placed in a single file. I guess this is the answer, but in python/django instead of ruby/rails. It would be a fun exercise in ruby/rails too (not totally sure if it's possible, but suspect it may be, albeit probably resulting in a larger file than the one you give above!)

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

#26

Earlier quoted context omitted.

Which django-tasks? This one that started development a month ago? https://github.com/RealOrangeOne/django-tasks

The very same. As mentioned in the article, it's going to be distributed with the newest version of Django.

I don't understand that. The article says '...an existing external project that served as a proof of concept', and the DEP calls it '...an "early-access" demo to get initial feedback'.

Although it looks interesting and I'll keep an eye on it, if I needed something right now, I wouldn't use it.

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

#27
post #3

Django getting background tasks built-in is going to be really nice. It sucked having to manage celery or similar alongside it.

You should check out Huey next time. It is a lifesaver for us. Allows us to do the tasks via SQLite db

I use Huey too. Very simple and easy to manage. From a quick look the proposed tasks system seems similar to it.

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

#28
post #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 develo…

I've been looking for know anything resembling django's ORM _including_ migrations in rust, but haven't found a good replacement.

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

#29
post #12

Earlier quoted context omitted.

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.

Here's how much is installed when you do `pip install django` currently: 122370 django python=103934,javascript=18407,xml=29 2734 sqlparse python=2734 1110 asgiref python=1110 This will probably change when `django-tasks` gets merged in. Here's what installing `flask` + `sqlalchemy` pulls in: 141314 sqlalchemy python=141314 11464 werkzeug python=11159,javascript=305 8934 greenlet cpp=4993,python=2729,ansic=1092,asm=1…

I suspect that people come to the conclusion that Django has performance issues by looking at synthetic benchmark rankings between frameworks. In that sense it may or may not be relatively slow, but it is probably fast-enough for almost all web services in-practice. And if you measure with all of the speediest HTTP interfaces and find out it isn't fast-enough, then frankly Python is probably not the right choice at all.

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

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

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