On 06-12-11 06:34, cberner wrote:
I've run into an issue with namespaced packages that are installed in
development mode.

I have two packages that are installed with pip in development mode
(pip install develop):
A.B.management.commands (code in ~/A.B/A/B/management/commands/) and
A.C.management.commands (~/A.C/A/C/management/commands)

A.B and A.C can be distributed separately via pip, and A is just a
namespace package (our company name, in my case).

The problem is that management commands in A.C aren't detected,
because manage.py relies on imp.find_module, and when installed in
development mode, setuptools uses egg-links (symlinks), which means
that find_module('A') returns the path to A.B (because it comes first
alphabetically), but not the path to A.C.

When the packages are installed (not in development mode) everything
works fine, because the packages are merged into the same directory
hierarchy in site-packages. Anyone have suggestions for fixing this?

Django doesn't really like namespace packages. The problem is with the applications in the INSTALLED_APPS list. Did you add 'A' in there? Then it is logical that it only finds one of the two.

You ought to add both 'B' and 'C' in the INSTALLED_APPS list.


For my, this defeats the purpose of namespace packages a bit. I was used myself to companyname.product packages, but in Django I've switched to packages named companyname-product (with a dash) and modules named companyname_product (with an underscore).

- You still have the companyname prefix.

- You get the full "companyname_product" in INSTALLED_APPS.

- You visually see the difference between the package dir and the python module dir.



Reinout

--
Reinout van Rees                    http://reinout.vanrees.org/
rein...@vanrees.org             http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

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

Reply via email to