Noobie, possibly dumb, question - Why are Pinax templates not inside each app?

22 views
Skip to first unread message

JoeCodeswell

unread,
May 25, 2010, 11:59:50 PM5/25/10
to Pinax Users
In Pinax, why aren't templates included in each app dir, right along
with views and urls and models? Why do they live under a separate
templates dir structure? Could Pinax not come closer to just draging
and dropping apps into a Project if templates were inside each app?
Some apps are visual and some are not. Same as it was with ocx's in
Microsoft's COM. Some components are visual and some are not. Keeping
all the elements together under one directory structure, would seem to
serve the goal of modularity, although separating them could help with
the DRY principle, I suppose.

If this is just too dumb for words, please feel free to ignore this
question. Thanks for a great framework.

All the best,

Joe

Suno Ano

unread,
May 26, 2010, 3:50:35 AM5/26/10
to pinax...@googlegroups.com

Joe> In Pinax, why aren't templates included in each app dir, right
Joe> along with views and urls and models? Why do they live under a
Joe> separate templates dir structure?

Have a look at

http://sunoano.name/ws/python.html#where_are_applications_located

JoeCodeswell

unread,
May 26, 2010, 1:52:08 PM5/26/10
to Pinax Users
Dear Suno,

I'm not sure you answered my question but, thanks for the good info.
You certainly added to my knowledge.

All the best,

Joe

James Tauber

unread,
May 26, 2010, 1:56:07 PM5/26/10
to pinax...@googlegroups.com

On May 25, 2010, at 11:59 PM, JoeCodeswell wrote:

> In Pinax, why aren't templates included in each app dir, right along
> with views and urls and models? Why do they live under a separate
> templates dir structure? Could Pinax not come closer to just draging
> and dropping apps into a Project if templates were inside each app?
> Some apps are visual and some are not. Same as it was with ocx's in
> Microsoft's COM. Some components are visual and some are not. Keeping
> all the elements together under one directory structure, would seem to
> serve the goal of modularity, although separating them could help with
> the DRY principle, I suppose.

Templates are almost always site-specific, or at least theme-specific.

So we provide default templates in a theme (and hope to provide more themes) but expect site developers will override them for their needs.

There may be cases where template fragments make sense in an app, but page-level templates in an app means the app making too many assumptions about the structure of a site and the layout of its pages.

Hope that helps explain our motivation.

James

JoeCodeswell

unread,
May 27, 2010, 2:27:20 PM5/27/10
to Pinax Users

Dear James,

I am honored that you replied to my question. I am going to indulge
myself with a follow up, knowing that, as a newbie, i don't really
have anything except my newness to offer.

My question was brought about because i have been following along with
the Django Book (DB) 2nd Ed., using the Pinax basic_project and the
framework, trying to do things in a Pinaxian way. I wanted to write my
own app to [quoting from DB chapter 7] "write a small view that
displays all of the request.META data so you can get to know what’s in
there. ... [and] see whether you can convert this view to use Django’s
template system instead of hard-coding the HTML."

For a Pinax example, I looked at [ C:\pinax072env\Lib\site-packages
\pinax\projects\social_project\apps\tag_app ] and then i searched for
the associated template. I finally found it in [ C:\pinax072env\Lib
\site-packages\pinax\projects\social_project\templates\tags ]. I
wondered why this fragment could not have been found right inside the
app directory.

:) SO HERE IS MY QUESTION. :) Would it be possible for Pinax to search
for the app's template in the app's directory as a first option?

I have NO IDEA of the implementation implications of this but i do
think it could go a bit of the way toward app "encapsulization" ala
OCX's and Microsoft COM. Thanks for the great framework, James.

All the best,

Joe

Reply all
Reply to author
Forward
0 new messages