Hi Phill,
On 08/28/2012 03:51 PM, Phill Tornroth wrote:
> 2. Are you also -1 on making it easier for projects like shell_plus to
> add locals to the shell? What's happening right now is pretty
> unfortunate. I can only see upside in an adjustment to the internal API
> that doesn't make this kind of duplication necessary.
I think this is a practically useful feature, but it's pretty far afield
for a web framework, IMO [1]. Ideally it could be handled by convenience
shells such as IPython without needing to add anything new to "manage.py
shell". I know that in older versions of IPython auto-imports could be
easily done with an ipy_user_conf.py file in the same directory as
manage.py; since "manage.py shell" runs IPython if installed, that
solves the problem. I think the customization system has changed in
newer IPython versions and I haven't looked into how to do it now - but
that still seems to me like basically the right approach.
Carl
[1] Of course, the same could be said for "manage.py shell" itself,
which, in Django 1.4 at least, is little more than a shortcut for
setting DJANGO_SETTINGS_MODULE and running a python shell. I'd love to
see "manage.py shell" disappear entirely from Django someday.