On Sat, Jul 21, 2012 at 8:46 PM, Melvyn Sopacua <m.r.sopa...@gmail.com> wrote:
> On 21-7-2012 3:26, Russell Keith-Magee wrote:
>> On Sat, Jul 21, 2012 at 3:32 AM, Nicolas Ardison <nicolas....@gmail.com> 
>> wrote:
>>> Hello, i was reading the Django documentation, and i have the following
>>> trouble that i'm not sure if django can solve it. I have a application
>>> called "userArea" and i want to extend that app with more app isolated from
>>> the "main" apps.
>>>
>>> [DjangoProject]
>>>
>>> [APP1]
>>>
>>> [subAPP1]
>>>
>>> [subAPP2]
>>>
>>> [APP2]
>>>
>>>
>>> Could i do something like this? anyone know where i can start reading about
>>> this.
>>
>> A Django app is just a Python module. That means you can nest them
>> however you like. As long as you provide a fully qualified path the
>> the leaf node of your nesting tree, you can use an app wherever it
>> occurs in your Python module namespace.
>>
>> However, you don't get any Django benefits out of nesting like this. A
>> Django app is a single module. Nesting a module inside another doesn't
>> mean that the Django app 'inherits' anything from its 'parent', or
>> anything like that. The only benefit would be organisational -- i.e.,
>> keeping all the code in a hierarchy so it's easier to find it later.
>
> Well, this isn't completely true. As I said in earlier mail, you need
> unique final part for INSTALLED_APPS.
> Secondly, you can't organize models as you wish, meaning you can't do:
> app/
>     models/
>            __init__.py
>            mymodel.py

erm... Yes, you can. The Django test suite contains an explicit
example of how this can be done. See the modeltests/model_package
tests.

Pro tip: You need to look into the "app_label" Meta argument [1].

[1] 
https://docs.djangoproject.com/en/dev/ref/models/options/#django.db.models.Options.app_label

So - again -- you *don't* get any benefits from Django from nesting an
app inside another app. Yes, the last part of the app module name
needs to be unique in your project, but otherwise, it doesn't matter
how deeply you nest your app modules -- an app is an app.

Yours,
Russ Magee %-)

-- 
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