top | item 45674897

(no title)

frio | 4 months ago

I love Django, and the new `tasks` framework to replace `celery` (/whatever processor you prefer) looks great.

I've only recently come back to it, and I do hope they continue to add more batteries to their "batteries included" framework over time. I was surprised just how much stuff I had to add to my little project that will require updating _outside_ the main framework, eg.:

* django-components for little template partials (I'm not sure the new partials feature is robust enough to replace this)

* django-(configurator,split-settings,pick-your-poison-here) for more robust settings management

* structlog for much better logging (feels like this should get baked into Python's stdlib...)

* debug-toolbar

* dj-database-url for parsing database URLs (should be baked in!)

* django-money

There's plenty of other deps that are less annoying/surprising (eg. Sentry, granian, Tailwind), but the set above feel like more or less like they should be baked in, and (to my mind) don't represent an inordinate amount of work to adopt.

Other than that, it's been a real pleasure coming back to it, and I'm excited for its continuation.

EDIT -- oh, and built-in static types, stubs and stubs-ext were a bit of a nightmare to get working well.

discuss

order

ranger_danger|4 months ago

In addition to the debug-toolbar, I'd really like people to know about https://github.com/jazzband/django-silk (no affiliation)

I just recently found it and it has been amazing. It logs all your requests and responses by default (but is quite configurable) as well as your SQL queries (and how many/how long they take), in an easily searchable database. It can even profile functions for you.

Makes it very to see at a glance what pages are slow for people, and why, so they can be optimized accordingly.

Waterluvian|4 months ago

Silk is so dang amazing I deploy it to devel and staging at work. It helps me so quickly drill down at bad ORM or SQL performance issues.

frio|4 months ago

This is neat, thanks :)

blef|4 months ago

I'm curious to see how you successfully got working well the types as I'm lost in the nightmare for a few days.

frio|4 months ago

In `pyproject.toml`:

    "django-stubs>=5.2",
    "django-stubs-ext>=5.2.2",
In `settings.py`, add:

    import django_stubs_ext

    django_stubs_ext.monkeypatch()

With that, it seems _mostly_ OK, though I had to toggle off some of basedpyright's typechecking.