Re: base.html (extended by others) has to be in project (not app) root?

2011-04-15 Thread Jeff Blaine
On Friday, April 15, 2011 4:21:56 PM UTC-4, Brian Neal wrote:
>
> You didn't post how you loaded the template in your view function. In 
> particular, what path string you used. 
>

Ah.  The missing piece to bring order to all of this confusion on my 
part.

I was using "myapp/index.html", per Tutorial 3's example.

Obviously (now), this is what was allowing my index.html to be found when 
using
TEMPLATE_DIRS = ('/myproject',)

... and also what was causing the app to expect to find "base.html" in
/myproject and not /myproject/myapp

And my failure to be able to use {% extend "myapp/base.html %} with my
TEMPLATE_DIR set as above was because... I had not MOVED IT to
myapp.  Geez.

This all makes perfect sense to me now and I have it working as I wanted it 
to.

Thank you all again for the help.

In any event, this isn't magic. I suggest you read this section of the 
> docs: 
>
> http://docs.djangoproject.com/en/1.3/ref/templates/api/#loading-templates 
>
> In particular, pay attention to the TEMPLATE_DIRS and TEMPLATE_LOADERS 
> settings in your project. Those settings control the template search 
> order. 
>
> Best, 
> BN

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



Re: base.html (extended by others) has to be in project (not app) root?

2011-04-15 Thread Brian Neal
On Apr 15, 2:23 pm, Jeff Blaine  wrote:
> Thank you all.  I will digest the replies when I have the time to properly
> focus back on the issue (it's obviously small, since I have a workaround in
> place by shoving base.html into the project root).
>
> It still, regardless of solutions, even in light of the words shared in this
> thread (which I've only skimmed for now), makes no sense to me how it's "the
> right thing" that my index.html is found but base.html cannot be found just
> because it is referenced by "extend".  I will have to decide for the
> time-being that there's some underlying good reason/concept that I just am
> not savvy to.
>
> You found index.html fine!  It says in it to extend "base.html"!  Find it in
> the same place you found index.html!

You didn't post how you loaded the template in your view function. In
particular, what path string you used.

In any event, this isn't magic. I suggest you read this section of the
docs:

http://docs.djangoproject.com/en/1.3/ref/templates/api/#loading-templates

In particular, pay attention to the TEMPLATE_DIRS and TEMPLATE_LOADERS
settings in your project. Those settings control the template search
order.

Best,
BN

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



Re: base.html (extended by others) has to be in project (not app) root?

2011-04-15 Thread Jeff Blaine
Thank you all.  I will digest the replies when I have the time to properly 
focus back on the issue (it's obviously small, since I have a workaround in 
place by shoving base.html into the project root).

It still, regardless of solutions, even in light of the words shared in this 
thread (which I've only skimmed for now), makes no sense to me how it's "the 
right thing" that my index.html is found but base.html cannot be found just 
because it is referenced by "extend".  I will have to decide for the 
time-being that there's some underlying good reason/concept that I just am 
not savvy to.

You found index.html fine!  It says in it to extend "base.html"!  Find it in 
the same place you found index.html!

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



Re: base.html (extended by others) has to be in project (not app) root?

2011-04-15 Thread Joel Goldstick
On Thu, Apr 14, 2011 at 4:50 PM, Yuka Poppe  wrote:

> Hi Jeff,
>
> I think Gladys is correct, the reason for your code finding the index
> template, is because its probably looking for 'myapp/index.html'
> instead of just 'index.html'
>
> Im not really sure if you're also distinguishing between the project
> template root and the app directory template dirs.
>
> Generally this would be how the template directories would be layed out:
>
> /whatever/templates
> /whatever/myproject/myapp/templates
> /whatever/myproject/mysecondapp/templates
>
> First django looks in the templates set in your settings.py
> (/whatever/templates) then, depending on the order in installed apps,
> it looks at /templates
>
>
> So when you try to extend just 'base.html' it tries
> /whatever/templates/base.html,
> /whatever/myproject/myapp/templates/base.html, /whatever/my.. etc.
> regardless of wheter or not the template where you are including from
> is in the same directory. So again, why your index.html is working and
> extending base.html doesnt work is in my best guess, due to the fact
> that your code was looking for 'myapp/index.html' and the template
> tried to include just 'base.html', which you said was located in
> 'myapp'
>
> Take note that if you do try to extend 'myapp/base.html' for the app
> based template directories, it would actually look in
> /whatever/myproject/myapp/templates/myapp/base.html, this might seem
> confusing at first.
>
> Hope this helps, Yuka
>
> On Thu, Apr 14, 2011 at 10:38 PM, Jeff Blaine  wrote:
> > Gladys,
> > On Thursday, April 14, 2011 4:12:29 PM UTC-4, gladys wrote:
> > The root directory for your templates is in  '/whatever/myproject', so
> >>
> >> of course it will look for your base.html here.
> >> Now if your base is in another location, say "/whatever/myproject/
> >> myapp/base.html", your extends should look like this:
> >> {% extends "myapp/base.html" %}.
> >
> > First, thanks for the reply.
> > It's finding my /myproject/myapp/index.html template (the one that calls
> > "base.html"), so something clearly knows about where to find my
> templates,
> > yet "extend" looks elsewhere.
> > That is, if I make /myproject/myapp/index.html to be completely
> > self-contained, it is found and loaded fine.
> > If I change it to {% extend "base.html" %}, it can't find that referenced
> > template.
> >
> > That seems broken to me.
> > I tried your suggestion above (the other day, and again now) in
> > /myproject/myapp/index.html
> > {% extend "myapp/base.html" %}
> >
> > It does not work:
> > Caught TemplateDoesNotExist while rendering: myapp/base.html
> > ALSO... I changed the following from:
> > TEMPLATE_DIRS = (
> > '/myproject',
> > )
> >
> > to:
> > TEMPLATE_DIRS = (
> > '/myproject/myapp',
> > )
> >
> > Which then results in failure to find even /myproject/myapp/index.html
> > TemplateDoesNotExist at /
> >
> >
> >>
> >> Best of Luck.
> >>
> >> --
> >> Gladys
> >> http://blog.bixly.com
> >>
> >>
> >> On Apr 15, 3:56 am, Jeff Blaine  wrote:
> >> > Django 1.3
> >> >
> >> > Hi all,
> >> >
> >> > I can't seem to get around this.  It appears that, the following
> >> > "index.html" template in */whatever/myproject/myapp*
> >> >
> >> > {% extends "base.html %}
> >> > 
> >> >
> >> > Looks for base.html as /whatever/myproject/base.html instead
> >> > of /whatever/myproject/myapp/base.html
> >> >
> >> > My TEMPLATE_DIRS is set as follows, and with this setting, the
> >> > */whatever/myproject/myapp/index.html
> >> > template is loaded fine* if I make it self-contained (not extending)
> >> >
> >> > TEMPLATE_DIRS = (
> >> > '/whatever/myproject',
> >> > )
> >> >
> >> > Any ideas?
> >
> > --
> > 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.
> >
>
> --
> 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.
>
>
In settings.py you have this:

>> > TEMPLATE_DIRS = (
>> > '/whatever/myproject',
>> > )
>

Note it says "DIRS", and its a tuple.  Add the other paths to where you want
to look for templates.

The way I've done my template layout is to have a template directory under
the project, then subdirectories for each app.

When you specify a template that is project level, you just use its name.
For app specific templates you specify like: "app1/mytemplate.html"


-- 
Joel Goldstick

-- 
You received this message because 

Re: base.html (extended by others) has to be in project (not app) root?

2011-04-14 Thread Yuka Poppe
Hi Jeff,

I think Gladys is correct, the reason for your code finding the index
template, is because its probably looking for 'myapp/index.html'
instead of just 'index.html'

Im not really sure if you're also distinguishing between the project
template root and the app directory template dirs.

Generally this would be how the template directories would be layed out:

/whatever/templates
/whatever/myproject/myapp/templates
/whatever/myproject/mysecondapp/templates

First django looks in the templates set in your settings.py
(/whatever/templates) then, depending on the order in installed apps,
it looks at /templates


So when you try to extend just 'base.html' it tries
/whatever/templates/base.html,
/whatever/myproject/myapp/templates/base.html, /whatever/my.. etc.
regardless of wheter or not the template where you are including from
is in the same directory. So again, why your index.html is working and
extending base.html doesnt work is in my best guess, due to the fact
that your code was looking for 'myapp/index.html' and the template
tried to include just 'base.html', which you said was located in
'myapp'

Take note that if you do try to extend 'myapp/base.html' for the app
based template directories, it would actually look in
/whatever/myproject/myapp/templates/myapp/base.html, this might seem
confusing at first.

Hope this helps, Yuka

On Thu, Apr 14, 2011 at 10:38 PM, Jeff Blaine  wrote:
> Gladys,
> On Thursday, April 14, 2011 4:12:29 PM UTC-4, gladys wrote:
> The root directory for your templates is in  '/whatever/myproject', so
>>
>> of course it will look for your base.html here.
>> Now if your base is in another location, say "/whatever/myproject/
>> myapp/base.html", your extends should look like this:
>> {% extends "myapp/base.html" %}.
>
> First, thanks for the reply.
> It's finding my /myproject/myapp/index.html template (the one that calls
> "base.html"), so something clearly knows about where to find my templates,
> yet "extend" looks elsewhere.
> That is, if I make /myproject/myapp/index.html to be completely
> self-contained, it is found and loaded fine.
> If I change it to {% extend "base.html" %}, it can't find that referenced
> template.
>
> That seems broken to me.
> I tried your suggestion above (the other day, and again now) in
> /myproject/myapp/index.html
> {% extend "myapp/base.html" %}
>
> It does not work:
>     Caught TemplateDoesNotExist while rendering: myapp/base.html
> ALSO... I changed the following from:
> TEMPLATE_DIRS = (
>     '/myproject',
> )
>
> to:
> TEMPLATE_DIRS = (
>     '/myproject/myapp',
> )
>
> Which then results in failure to find even /myproject/myapp/index.html
>     TemplateDoesNotExist at /
>
>
>>
>> Best of Luck.
>>
>> --
>> Gladys
>> http://blog.bixly.com
>>
>>
>> On Apr 15, 3:56 am, Jeff Blaine  wrote:
>> > Django 1.3
>> >
>> > Hi all,
>> >
>> > I can't seem to get around this.  It appears that, the following
>> > "index.html" template in */whatever/myproject/myapp*
>> >
>> > {% extends "base.html %}
>> > 
>> >
>> > Looks for base.html as /whatever/myproject/base.html instead
>> > of /whatever/myproject/myapp/base.html
>> >
>> > My TEMPLATE_DIRS is set as follows, and with this setting, the
>> > */whatever/myproject/myapp/index.html
>> > template is loaded fine* if I make it self-contained (not extending)
>> >
>> > TEMPLATE_DIRS = (
>> >     '/whatever/myproject',
>> > )
>> >
>> > Any ideas?
>
> --
> 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.
>

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



Re: base.html (extended by others) has to be in project (not app) root?

2011-04-14 Thread Jeff Blaine
Gladys,

On Thursday, April 14, 2011 4:12:29 PM UTC-4, gladys wrote:
The root directory for your templates is in  '/whatever/myproject', so 
>
> of course it will look for your base.html here. 
> Now if your base is in another location, say "/whatever/myproject/ 
> myapp/base.html", your extends should look like this: 
> {% extends "myapp/base.html" %}. 
>

First, thanks for the reply.

It's *finding* my /myproject/myapp/*index.html* template (the one that calls 
"base.html"), so something clearly knows about where to find my templates, 
yet "extend" looks elsewhere.

That is, if I make /myproject/myapp/index.html to be completely 
self-contained, it is found and loaded fine.

If I change it to {% extend "base.html" %}, it can't find that referenced 
template.

That seems broken to me.

I tried your suggestion above (the other day, and again now) in 
/myproject/myapp/index.html

{% extend "myapp/base.html" %}

It does not work:

Caught TemplateDoesNotExist while rendering: myapp/base.html

ALSO... I changed the following from:

TEMPLATE_DIRS = (
'/myproject',
)

to:

TEMPLATE_DIRS = (
'/myproject/myapp',
)

Which then results in failure to find even /myproject/myapp/index.html

TemplateDoesNotExist at /

 

>
> Best of Luck. 
>
> -- 
> Gladys 
> http://blog.bixly.com 
>
>
> On Apr 15, 3:56 am, Jeff Blaine  wrote: 
> > Django 1.3 
> > 
> > Hi all, 
> > 
> > I can't seem to get around this.  It appears that, the following 
> > "index.html" template in */whatever/myproject/myapp* 
> > 
> > {% extends "base.html %} 
> >  
> > 
> > Looks for base.html as /whatever/myproject/base.html instead 
> > of /whatever/myproject/myapp/base.html 
> > 
> > My TEMPLATE_DIRS is set as follows, and with this setting, the 
> */whatever/myproject/myapp/index.html 
> > template is loaded fine* if I make it self-contained (not extending) 
> > 
> > TEMPLATE_DIRS = ( 
> > '/whatever/myproject', 
> > ) 
> > 
> > Any ideas?

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



Re: base.html (extended by others) has to be in project (not app) root?

2011-04-14 Thread gladys
Hello,

The root directory for your templates is in  '/whatever/myproject', so
of course it will look for your base.html here.
Now if your base is in another location, say "/whatever/myproject/
myapp/base.html", your extends should look like this:
{% extends "myapp/base.html" %}.

Best of Luck.

--
Gladys
http://blog.bixly.com


On Apr 15, 3:56 am, Jeff Blaine  wrote:
> Django 1.3
>
> Hi all,
>
> I can't seem to get around this.  It appears that, the following
> "index.html" template in */whatever/myproject/myapp*
>
> {% extends "base.html %}
> 
>
> Looks for base.html as /whatever/myproject/base.html instead
> of /whatever/myproject/myapp/base.html
>
> My TEMPLATE_DIRS is set as follows, and with this setting, the 
> */whatever/myproject/myapp/index.html
> template is loaded fine* if I make it self-contained (not extending)
>
> TEMPLATE_DIRS = (
>     '/whatever/myproject',
> )
>
> Any ideas?

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



base.html (extended by others) has to be in project (not app) root?

2011-04-14 Thread Jeff Blaine
Django 1.3

Hi all,

I can't seem to get around this.  It appears that, the following 
"index.html" template in */whatever/myproject/myapp*

{% extends "base.html %}


Looks for base.html as /whatever/myproject/base.html instead 
of /whatever/myproject/myapp/base.html

My TEMPLATE_DIRS is set as follows, and with this setting, the 
*/whatever/myproject/myapp/index.html 
template is loaded fine* if I make it self-contained (not extending)

TEMPLATE_DIRS = (
'/whatever/myproject',
)

Any ideas?

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