Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 18, 2005 21:32:59

P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why it doesn't work in Django


I have a following problem with CSS file.

My template Test.html looks like this
######################
<html>
<head>
<link rel="StyleSheet" href="Test.css" type-"text/css" >
</head>

<body>

TEST ONLY
</body>
</html>
###################

where Test.css looks like this
###################

body
{
background: #000000;
color: #FFFFFF;
font: 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica,
sans-serif;
margin: 5px 5px 10px 5px;
}
#################

And now when I open the Test.html file in my web browser I will receive
black background with the white TEST ONLY text, which is correct

But when I try it in Django like
####################
...
...
return render_to_response('board/Test')
###################
it does NOT work( the text is not white and background is not black.

But why? Where did I make a mistake?
Thanks for help.
L.

Offline

#2 Nov. 18, 2005 21:36:40

Bryan L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why it doesn't work in Django


On Fri, Nov 18, 2005 at 01:32:34PM -0800, PythonistL wrote:

> But why? Where did I make a mistake?

because it's trying to serve the page like it's a view. For instance, if
your view is /foo/bar, go to /foo/style.css and you'll get a 404. But that's
where it's trying to load it.

You'll want to serve the style sheet from another place.

--B

Offline

#3 Nov. 18, 2005 21:37:38

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why it doesn't work in Django


On 11/18/05, PythonistL <> wrote:
> it does NOT work( the text is not white and background is not black.
>
> But why? Where did I make a mistake?

The Web page isn't recognizing your CSS file. Django isn't intended
serve static media files -- such as CSS -- so you'll need to use
another server, such as Apache, to serve the CSS file. Alternatively,
check out the django.views.static.serve, which is for development
purposes only and isn't yet documented (but will be soon).

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#4 Nov. 18, 2005 22:06:37

David A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why it doesn't work in Django


On 11/18/05,Adrian Holovaty<> wrote:The Web page isn't recognizing your CSS file. Django isn't intendedserve static media files -- such as CSS -- so you'll need to useanother server, such as Apache, to serve the CSS file. Alternatively,check out the
django.views.static.serve, which is for developmentpurposes only and isn't yet documented (but will be soon).There is draft docs in this ticket:http://code.djangoproject.com/ticket/810(helped me).--david

Offline

#5 Nov. 19, 2005 18:15:25

P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why it doesn't work in Django


Thank you ALL for the explanation.
I checkedhttp://code.djangoproject.com/ticket/810to try
django.views.static.serve and it worked with CSS.
.
But I found out that in CSS file I can not use

p.
EntryField
{...
...
...
}

but must use

p.EntryField
{...
...
...
}

I also tried django.views.static.serve with the images. An image file
is found ( HTTP/1.0 200 OK) but the image is distorted( damaged). Why?

Regards,
L.

Offline

#6 Nov. 20, 2005 01:51:45

Eugene L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why it doesn't work in Django


"PythonistL" <> wrote in message

>
> I also tried django.views.static.serve with the images. An image file
> is found ( HTTP/1.0 200 OK) but the image is distorted( damaged). Why?

Do you use Windows?

Thanks,

Eugene

Offline

#7 Nov. 21, 2005 06:17:42

P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why it doesn't work in Django


Yes, I use XP windows
Regards,
L.

Offline

#8 Nov. 21, 2005 07:04:52

Eugene L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why it doesn't work in Django


I see. I've submitted a patchhttp://code.djangoproject.com/ticket/866.

Thanks,

Eugene


"PythonistL" <> wrote in message

>
> Yes, I use XP windows
> Regards,
> L.
>
>

Offline

#9 Nov. 21, 2005 15:38:36

P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why it doesn't work in Django


Eugene, Thank you.
If I download the latest development version, will be the change
already present?
Or where can I find the file in Django installation to apply the patch
by myself?
thank you
regards,
L.

Offline

#10 Nov. 21, 2005 15:43:07

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Why it doesn't work in Django


On 11/21/05, PythonistL <> wrote:
> If I download the latest development version, will be the change
> already present?
> Or where can I find the file in Django installation to apply the patch
> by myself?

The change was checked in earlier this morning; it's in the development version.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

Board footer

Moderator control

Enjoy the 20th of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support