Tuesday, August 30, 2011

Re: App namespace/packages?

On 30-08-11 09:57, Danny W. Adair wrote:
> I think a shop system is a good example, and looking at satchmo I saw
> apps called "satchmo_this" and "satchmo_that".
> I'd rather see such apps packaged up so it's clear where they belong
> to.
>
> Before posting a feature request on the issue tracker I thought I'd
> ask how other people deal with this situation?
> I'd love if all apps were in a directory "apps", and the various
> loaders allowed me to go another level.

Django doesn't play nice with namespace packages as are possible with
setuptools. It just looks at the part after the last dot for many
internals, like database table naming.

So what we're doing is name our packages with a dash and a common
prefix: "lizard-ui", "lizard-map", "lizard-shape". The python modules
within it are the same, but with an underscore (lizard_ui, lizard_map,
lizard_shape).

The only reason for the dash/underscore difference is that it makes it
easier to spot in which directory you are (the dash is the one with the
setup.py, the underscore is the directory with the code within that
outer-one-with-the-dash).

Reinout

--
Reinout van Rees http://reinout.vanrees.org/
reinout@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment