On 11/19/05, Andreas Stuhlmüller <[EMAIL PROTECTED]> wrote:
> Are there any guidelines for managing large applications with Django?
> Most of the time it is possible to split those into several smaller
> apps, but sometimes it isn't - what is the recommended way to handle
> large apps? For example, does Django support splitting the models file
> into several packages? This seems to be fairly easy for the views, but
> the meta magic might make turning
>
>     models/
>         __init__.py
>         myapp.py
>
> into
>
>     models/
>         __init__.py
>         myapp/
>             __init__.py
>             first.py
>             second.py

Here are the two requirements for multi-module models:

* All the model modules have to live *directly* within the models
directory -- so the multi-level example you gave wouldn't work.

* In models/__init__.py, the __all__ variable must be set to a list of
all the model module names.

In practice, this isn't really a limitation. World Online (original
creators of Django) has quite a few large Django applications, and
putting all the models in a single "models" package isn't really a big
deal.

You can always split models across other *apps*, rather than creating
subdirectories within "models".

Hope this helps! Let me know if any of it wasn't clear.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Reply via email to