On Sat, Jan 7, 2012 at 7:24 PM, IgorS <igor.shm...@gmail.com> wrote:
> Can someone recommend “the optimal” directory layout INSIDE the
> application’s root directory for a large application. The question is
> about one application only, not the whole project.
>
> I am looking for a layout where all the code, settings, static stuff
> (images, css, js), etc. relating to this particular application stay
> inside the application’s root directory. It is probably ok to set a
> couple of values in the project's settings.py, but everything else
> should be inside the application’ directory. Something completely plug
> and play (even in a production environment)…
>
> If something “must” or should go outside of the application’s root
> (for speed optimization, etc.), that is great to know too.
>
> If, apart from the recommendations, someone could point at an existing
> large well-structured application, that would be awesome.
>
> Below is my current structure. I am new to Django and probably missing
> something... Restructuring an application somewhere in the middle of
> the development cycle is more expensive than just having the "right"
> layout from the start. Especially if this is possible. I consider a
> small overhead at the start being better than a great rework in the
> middle (yes, i am aware of the minimal viable product concept :-)
>
> app
>        +--models
>                ---abstract_base.py
>                ---core.py
>                ---...
>        +--probe
>        +--static
>                ---css
>                ---js
>                ---images
>        +--templates
>                ---base.html
>                ---...
>        +--tests
>                ---test_users.py
>                ---...
>        +--utils
>        +--views
>        ---__init__.py
>        ---app_settings.py
>        ---context_processors.py
>        ---middleware.py
>        ---urls.py
>

Looks pretty good, the only thing I would change would be to prefix
templates and static files with the app name, by placing them inside a
directory named after the app, eg 'app/templates/app/index.html', as
this will avoid conflicts with other templates/static media.

Cheers

Tom

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