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:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{% block title %} Home {% endblock title %}</title>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" /
>
<link href="static/css/style.css" rel="stylesheet"
type="text/css" /
>
<script type="text/javascript" src="static/js/functions.js"></
script>
</head>
<body>
...
</body>
</html>
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:80000/work-subfold1" instead of "http://localhost:
80000/work/subfold1/") Otherwise I lose the CSS.
http://localhost:80000/work <---- works fine
http://localhost:80000/work-subfold1 <---- works fine
http://localhost:80000/work/ <--- doesn't work fine
(Cannot see the CSS)
http://localhost:80000/work-subfold1/ <--- doesn't work fine (Cannot
see the CSS)
http://localhost:80000/work/subfold1/ <--- doesn't work fine (Cannot
see the CSS)
On Jun 19, 4:09 pm, Karen Tracey <[email protected]> wrote:
> On Fri, Jun 19, 2009 at 3:58 PM, mojo <[email protected]> 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/ <http://localhost:8000/work/%0Aw1/>"). 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:80000/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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---