-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/03/2011 08:05 AM, [email protected] wrote:
> `django.core.management.find_management_module()` has this description
> in the docstring that says it determines the path "without actually
> importing the application or the management module". Currently it
> doesn't support namespace packages and there's a long open ticket
> about it [1].
> 
> My question is a slightly philosophical one: why is it that important
> to not import the management module at that point?

My best guess is that it was done that way so that "manage.py help"
would not require DJANGO_SETTINGS_MODULE (or equivalent). If you start
importing apps it'd be fairly easy for one of them to try to access
settings or import something else that does. It's not very friendly to
get an ImproperlyConfigured just from running "manage.py help."

Of course, (like pretty much anything related to
DJANGO_SETTINGS_MODULE), this is just ugly. It would be much better if
management-command-finding respected all the same varieties of
importability that Python itself does. But we'd have to balance that
against the above issue, at least until that day when we can kill
DJANGO_SETTINGS_MODULE and import-time exceptions in Django.

Carl

> I'm asking because I'm using an unholy monkey patch [2] that
> shamelessly uses __import__ and I'm yet to discover why that's
> troublesome. It's been in heavy use for 18 months now.
> 
> [1] https://code.djangoproject.com/ticket/14087
> [2] 
> https://github.com/LangaCore/kitdjango/blob/master/src/lck/django/namespace_package_support.py
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6KGxoACgkQ8W4rlRKtE2cKbQCgjRg2PQcB7EwOtwKOPBINOe1+
0tUAoIFhHFlnfi4qMVn1+zjSQNVP8bq2
=F8NZ
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to