Re: My templates don't render correctly

2009-06-19 Thread mojo

Will... I thought there is a problem with "media_root","settings.py",
or the way I served the static files... I didn't expect that at all...
But, that solved the problem! I really appreciated it!

Thank you!

On Jun 19, 9:03 pm, Gabriel  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> mojo escribió:
>
> >            {% block title %} Home {% endblock title %}
> >             >             > type="text/css" /
> >            

Re: My templates don't render correctly

2009-06-19 Thread Gabriel

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

mojo escribió:
>   {% block title %} Home {% endblock title %}
>   type="text/css" /
>   

Re: My templates don't render correctly

2009-06-19 Thread mojo

Thanks for the reply Karen... but I still didn't get the CSS thing.

here how is "mysite" folder looks like:

settings.py
urls.py
...
...
templates/
   - _base.html
 - index.html
 - work/
   - _base_work.html
- subfold1/
  -sub1_index.html
- subfold2/
- f1_index.html
 - fold2/
- subfold1/
- subfold2/
- f2_index.html
 - fold3/
- subfold1/
- subfold2/
- f3_index.html
static/
   - css/
- style.css
   - js/
   - imgs/


in _base.html I have something like this:


http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;>
http://www.w3.org/1999/xhtml;>

{% block title %} Home {% endblock title %}





...




Also, under each folder there is another template that extends the
_base.html template. For example, in _base_work.html I have:

{% extends "_base.htm" %}
...
...

and the "f1_index.html" looks like this:

{% extends "work/_base_work.html" %}
{% block bodycontentlocal %}
...
...
{% endblock bodycontentlocal %}


All my links in the project are absolute, and all files work fine if I
didn't add the "/" before the "$" and if I don't have hierarchy
("http://localhost:8/work-subfold1; instead of "http://localhost:
8/work/subfold1/") Otherwise I lose the CSS.

http://localhost:8/work < works fine
http://localhost:8/work-subfold1< works fine

http://localhost:8/work/<--- doesn't work fine
(Cannot see the CSS)
http://localhost:8/work-subfold1/   <--- doesn't work fine (Cannot
see the CSS)
http://localhost:8/work/subfold1/   <--- doesn't work fine (Cannot
see the CSS)



On Jun 19, 4:09 pm, Karen Tracey  wrote:
> On Fri, Jun 19, 2009 at 3:58 PM, mojo  wrote:
>
> > [snip]
> > in the "urls.py" file
> > ...
> > ...
> > (r'^work$',  direct_to_template, {'template': 'work/f1_index.html'}),
> > (r'^work/w1/$',  direct_to_template, {'template': 'work/subfold1/
> > sub1_index.html'}),
> > ...
> > ...
>
> > when I open the page: (http://localhost:8000/work), then everything
> > looks fine, but wen I tried to add "/" at the end then I get some
> > errors (which I understand)
>
> > If I changed the "urls.py" to...
> > ...
> > ...
> > (r'^work/$',  direct_to_template, {'template': 'work/f1_index.html'}),
> > (r'^work/w1/$',  direct_to_template, {'template': 'work/subfold1/
> > sub1_index.html'}),
> > ...
> > ...
>
> > and opened the page ("http://localhost:8000/work; or "http://localhost:
> > 8000/work/"), then I cannot see my CSS stuff. Just plain text in
> > arranged in a column.
>
> > That happens too if I tried to open ("http://localhost:8000/work/
> > w1/ "). Cannot see the CSS stuff, even
> > if I removed the "/" before "$"
>
> > I would really appreciate it if someone can help me.
>
> You've left out of the puzzle how, exactly, you are specifying the CSS in
> your .html files. Based on the behavior it sounds like you have made the
> links relative but they need to be absolute.  Notice it only works when the
> page including the CSS has only one level and doesn't have a trailing slash,
> meaning the last level is dropped before constructing a relative link.
> Dropping the trailing slash doesn't fix 
> thehttp://localhost:8/work/w1casebecause only the w1 is dropped
> then, not work.
>
> Karen
--~--~-~--~~~---~--~~
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: My templates don't render correctly

2009-06-19 Thread Karen Tracey
On Fri, Jun 19, 2009 at 3:58 PM, mojo  wrote:

>
> [snip]
> in the "urls.py" file
> ...
> ...
> (r'^work$',  direct_to_template, {'template': 'work/f1_index.html'}),
> (r'^work/w1/$',  direct_to_template, {'template': 'work/subfold1/
> sub1_index.html'}),
> ...
> ...
>
>
> when I open the page: (http://localhost:8000/work), then everything
> looks fine, but wen I tried to add "/" at the end then I get some
> errors (which I understand)
>
> If I changed the "urls.py" to...
> ...
> ...
> (r'^work/$',  direct_to_template, {'template': 'work/f1_index.html'}),
> (r'^work/w1/$',  direct_to_template, {'template': 'work/subfold1/
> sub1_index.html'}),
> ...
> ...
>
> and opened the page ("http://localhost:8000/work; or "http://localhost:
> 8000/work/"), then I cannot see my CSS stuff. Just plain text in
> arranged in a column.
>
> That happens too if I tried to open ("http://localhost:8000/work/
> w1/ "). Cannot see the CSS stuff, even
> if I removed the "/" before "$"
>
> I would really appreciate it if someone can help me.
>

You've left out of the puzzle how, exactly, you are specifying the CSS in
your .html files. Based on the behavior it sounds like you have made the
links relative but they need to be absolute.  Notice it only works when the
page including the CSS has only one level and doesn't have a trailing slash,
meaning the last level is dropped before constructing a relative link.
Dropping the trailing slash doesn't fix the
http://localhost:8/work/w1case because only the w1 is dropped
then, not work.

Karen

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



My templates don't render correctly

2009-06-19 Thread mojo

Does anyone know why django doesn't render pages with trailing
slashes?

I have a template that looks something like this:

templates/
 - _base.html
 - index.html
 - work/
- subfold1/
  -sub1_index.html
- subfold2/
- f1_index.html
 - fold2/
- subfold1/
- subfold2/
- f2_index.html
 - fold3/
- subfold1/
- subfold2/
- f3_index.html

and I have a django project that I named it "mysite"

in the "urls.py" file
...
...
(r'^work$',  direct_to_template, {'template': 'work/f1_index.html'}),
(r'^work/w1/$',  direct_to_template, {'template': 'work/subfold1/
sub1_index.html'}),
...
...


when I open the page: (http://localhost:8000/work), then everything
looks fine, but wen I tried to add "/" at the end then I get some
errors (which I understand)

If I changed the "urls.py" to...
...
...
(r'^work/$',  direct_to_template, {'template': 'work/f1_index.html'}),
(r'^work/w1/$',  direct_to_template, {'template': 'work/subfold1/
sub1_index.html'}),
...
...

and opened the page ("http://localhost:8000/work; or "http://localhost:
8000/work/"), then I cannot see my CSS stuff. Just plain text in
arranged in a column.

That happens too if I tried to open ("http://localhost:8000/work/
w1/"). Cannot see the CSS stuff, even if I removed the "/" before "$"

I would really appreciate it if someone can help me.

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