# Add SHELL\_IMPORTS settings to shell

**URL:** <https://forum.djangoproject.com/t/add-shell-imports-settings-to-shell/32184>\
**Category:** Django Internals\
**Created:** [June 18, 2024, 7:28am UTC](https://forum.djangoproject.com/t/add-shell-imports-settings-to-shell/32184 "2024-06-18T07:28:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![salvo-polizzi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/salvo-polizzi/32/17512_2.png) [@salvo-polizzi](https://forum.djangoproject.com/u/salvo-polizzi)\
**Post date:** [June 18, 2024, 7:28am UTC](https://forum.djangoproject.com/t/add-shell-imports-settings-to-shell/32184/1 "2024-06-18T07:28:24Z")

</div>

Hi folks,

I’m working on a new feature for the auto-importing shell. The main goals we have achieved so far are:

- Building a namespace that maps every name to its model, and using that namespace as the shell namespace.
- Avoiding collisions by giving precedence to the apps listed first in `INSTALLED_APPS`.
- Providing access to models that have name collisions by importing all modules’ models with the label `<app_label>_models`. For example, if you want to access an overridden model from the `auth` app, you can still access that model using the `auth_models` module.

Currently, there is an ongoing discussion about the [SHELL\_IMPORTS](https://django-extensions.readthedocs.io/en/latest/shell_plus.html?highlight=shell%20plus#additional-imports) setting. Following the proposal by @DevilsAutumn in this [post](https://forum.djangoproject.com/t/gsoc-2024-auto-importing-in-the-shell/30749/9), the idea is to add this new setting. This would allow advanced users to perform manipulations or preprocess data by overriding the command, and it would simplify customization for beginner users so that they don’t have to subclass the command and override a method.

I would love to hear your feedback about this setting!

---

<div class="post-metadata">

**Author:** ![blackpingus](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/blackpingus/32/10171_2.png) [@blackpingus](https://forum.djangoproject.com/u/blackpingus)\
**Post date:** [June 24, 2024, 1:13pm UTC](https://forum.djangoproject.com/t/add-shell-imports-settings-to-shell/32184/2 "2024-06-24T13:13:50Z")

</div>

Hi,

here at $work we use the shell\_plus and configure it via custom SHELL\_PLUS\_PRE\_IMPORTS/SHELL\_PLUS\_IMPORTS/SHELL\_PLUS\_POST\_IMPORTS in base setting;  
and almost every developer customize it in its own local settings.

Configure via custom command will require us to update our projects (and project templates) to configure default import with common imports  
and write another custom command to configure locally (one for each project for each developer for each instance, so not so handy).

Another case: we use the form “from xxx.shortcuts import \*” (shortcuts for shell management), which I don’t understand how to translate to the dictionary form (yes, star import is bad, but these are careful crafted modules for specific purpose).

In short: we would love to see SHELL\_IMPORT support, or anyway we will add support in an our custom command.
