Comment by bodge5000

Comment by bodge5000 4 days ago

3 replies

I'll add one; Add shell_plus. It makes the django shell so much nicer to use, especially on larger projects (mostly because it auto-imports all your models). IIRC, it involves adding ipython and django_extensions as a dependency, and then adding django-extensions (annoyingly, note that the underscore changes to a dash, this trips me up everytime I add it) to your installed apps.

Saying that, I'm sure django-extensions does a lot more than shell_plus but I've never actually explored what those extra features are, so think I'll do that now

Edit: Turns out you can use bpython, ptpython or none at all with shell_plus, so good to know if you prefer any of them to ipython

el_io 4 days ago

> mostly because it auto-imports all your models

Django does this by default now. Since 5.0 if I'm remembering it correctly.

  • anticodon 3 days ago

    shell_plus is still superior because it also imports other useful stuff and allows adding custom list of additional imports.

    Also, shell_plus has --print-sql option for easy construction and debugging of ORM queries.

  • bodge5000 4 days ago

    In the default shell? I've definitely started new django projects since 2023 and I seem to remember always having to use shell_plus for that, though maybe thats just become something I automatically add without thinking

    Edit: Yep, you're right, wow thats pretty big for me