Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 19, 2011 19:55:52

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

Django Template CSS Load Path


I am trying to load a css file in my base.html template

<html>
<!-- Test Comment -->
<head>
<title>{% block title %}Test{% endblock %} </title>
<link rel="stylesheet" type="text/css" href="css/amr.css" />
</head>

What kind of path is supposed to go in the href? Is it relative to the
document root?

Does anyone have an example of loading a css file including the Apache
configuration?

Thanks.
cmn

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 19, 2011 20:30:40

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

Django Template CSS Load Path


You can use MEDIA_URL conf to get the root path to your media files.

<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/site.css" />


On Wed, Jan 19, 2011 at 5:55 PM, octopusgrabbus
<old_road_f...@verizon.net>wrote:

> I am trying to load a css file in my base.html template
>
> <html>
> <!-- Test Comment -->
> <head>
> <title>{% block title %}Test{% endblock %} </title>
> <link rel="stylesheet" type="text/css" href="css/amr.css" />
> </head>
>
> What kind of path is supposed to go in the href? Is it relative to the
> document root?
>
> Does anyone have an example of loading a css file including the Apache
> configuration?
>
> Thanks.
> cmn
>
> --
> 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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>


--
Eduardo Cereto Carvalho

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 19, 2011 21:03:16

Matías I.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django Template CSS Load Path


On Wed, Jan 19, 2011 at 5:30 PM, Eduardo Cereto Carvalho <
eduardocer...@gmail.com> wrote:

> You can use MEDIA_URL conf to get the root path to your media files.
>
> <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/site.css"
> />
>
>
the above code is correct, just make sure that you are using the media
context processor or returning a RequestContext, not just plain Context.
Check out your settings.py for this one of this in the
TEMPLATE_CONTEXT_PROCESSORS constant.

'django.core.context_processors.request',
'django.core.context_processors.media',



>
> On Wed, Jan 19, 2011 at 5:55 PM, octopusgrabbus <old_road_f...@verizon.net
> > wrote:
>
>> I am trying to load a css file in my base.html template
>>
>> <html>
>> <!-- Test Comment -->
>> <head>
>> <title>{% block title %}Test{% endblock %} </title>
>> <link rel="stylesheet" type="text/css" href="css/amr.css" />
>> </head>
>>
>> What kind of path is supposed to go in the href? Is it relative to the
>> document root?
>>
>> Does anyone have an example of loading a css file including the Apache
>> configuration?
>>
>> Thanks.
>> cmn
>>
>> --
>> 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<django-users%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>>http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> Eduardo Cereto Carvalho
>
> --
> 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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>



--
Matías Iturburuhttp://www.linkedin.com/in/miturburu|http://ltmo.com.ar--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Jan. 29, 2011 19:17:24

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

Django Template CSS Load Path


I still cannot get the css page to load.

On Jan 19, 4:02 pm, Matías Iturburu <maturb...@gmail.com> wrote:
> On Wed, Jan 19, 2011 at 5:30 PM, Eduardo Cereto Carvalho <
>
> eduardocer...@gmail.com> wrote:
> > You can use MEDIA_URL conf to get the root path to your media files.
>
> > <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/site.css"
> > />
>

My MEDIA_URL is MEDIA_URL = 'http://localhost:8002/'

I have added <link rel="stylesheet" type="text/css"
href='{{ MEDIA_URL }}/static/PageStyle.css' />
to my base template.

I'm not sure what changes I'm supposed to make regarding
TEMPLATE_CONTEXT_PROCESSORS. I don't have that constant in my
settings.py nor do I have 'django.core.context_processors.request'
or 'django.core.context_processors.media' in any of my application
files.

tnx
cmn

> the above code is correct, just make sure that you are using the media
> context processor or returning a RequestContext, not just plain Context.
> Check out your settings.py for this one of this in the
> TEMPLATE_CONTEXT_PROCESSORS constant.
>
> 'django.core.context_processors.request',
> 'django.core.context_processors.media',
>
>
>
>
>
> > On Wed, Jan 19, 2011 at 5:55 PM, octopusgrabbus <old_road_f...@verizon.net
> > > wrote:
>
> >> I am trying to load a css file in my base.html template
>
> >> <html>
> >> <!-- Test Comment -->
> >> <head>
> >> <title>{% block title %}Test{% endblock %} </title>
> >> <link rel="stylesheet" type="text/css" href="css/amr.css" />
> >> </head>
>
> >> What kind of path is supposed to go in the href? Is it relative to the
> >> document root?
>
> >> Does anyone have an example of loading a css file including the Apache
> >> configuration?
>
> >> Thanks.
> >> cmn
>
> >> --
> >> 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<django-users%2bunsubscr...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Eduardo Cereto Carvalho
>
> > --
> > 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<django-users%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Matías Iturburuhttp://www.linkedin.com/in/miturburu|http://ltmo.com.ar--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Jan. 29, 2011 19:49:41

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

Django Template CSS Load Path


Interestingly, I added

TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request',
'django.core.context_processors.media',
)

to my settings.py and got this error.

Put 'django.contrib.auth.context_processors.auth' in your
TEMPLATE_CONTEXT_PROCESSORS setting in order to use the admin
application.

My vhosts log file shows the css is being fetched. There are no
errors. But I am not seeing the page color change to light blue.

tnx
cmn

On Jan 19, 4:02 pm, Matías Iturburu <maturb...@gmail.com> wrote:
> On Wed, Jan 19, 2011 at 5:30 PM, Eduardo Cereto Carvalho <
>
> eduardocer...@gmail.com> wrote:
> > You can use MEDIA_URL conf to get the root path to your media files.
>
> > <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/site.css"
> > />
>
> the above code is correct, just make sure that you are using the media
> context processor or returning a RequestContext, not just plain Context.
> Check out your settings.py for this one of this in the
> TEMPLATE_CONTEXT_PROCESSORS constant.
>
>     'django.core.context_processors.request',
>     'django.core.context_processors.media',
>
>
>
>
>
> > On Wed, Jan 19, 2011 at 5:55 PM, octopusgrabbus <old_road_f...@verizon.net
> > > wrote:
>
> >> I am trying to load a css file in my base.html template
>
> >> <html>
> >>    <!-- Test Comment -->
> >>    <head>
> >>        <title>{% block title %}Test{% endblock %} </title>
> >>        <link rel="stylesheet" type="text/css" href="css/amr.css" />
> >>   </head>
>
> >> What kind of path is supposed to go in the href? Is it relative to the
> >> document root?
>
> >> Does anyone have an example of loading a css file including the Apache
> >> configuration?
>
> >> Thanks.
> >> cmn
>
> >> --
> >> 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<django-users%2bunsubscr...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Eduardo Cereto Carvalho
>
> > --
> > 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<django-users%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Matías Iturburuhttp://www.linkedin.com/in/miturburu|http://ltmo.com.ar--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#6 Jan. 31, 2011 05:47:01

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

Django Template CSS Load Path


change
href='{{ MEDIA_URL }}/static/PageStyle.css' />
to
href='{{ MEDIA_URL }}static/PageStyle.css' />

-----Original Message-----
From: django-users@googlegroups.com On
Behalf Of octopusgrabbus
Sent: 29 January 2011 21:17
To: Django users
Subject: Re: Django Template CSS Load Path

I still cannot get the css page to load.

On Jan 19, 4:02 pm, Matías Iturburu <maturb...@gmail.com> wrote:
> On Wed, Jan 19, 2011 at 5:30 PM, Eduardo Cereto Carvalho <
>
> eduardocer...@gmail.com> wrote:
> > You can use MEDIA_URL conf to get the root path to your media files.
>
> > <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/site.css"
> > />
>

My MEDIA_URL is MEDIA_URL = 'http://localhost:8002/'

I have added <link rel="stylesheet" type="text/css"
href='{{ MEDIA_URL }}/static/PageStyle.css' />
to my base template.

I'm not sure what changes I'm supposed to make regarding
TEMPLATE_CONTEXT_PROCESSORS. I don't have that constant in my
settings.py nor do I have 'django.core.context_processors.request'
or 'django.core.context_processors.media' in any of my application
files.

tnx
cmn

> the above code is correct, just make sure that you are using the media
> context processor or returning a RequestContext, not just plain Context.
> Check out your settings.py for this one of this in the
> TEMPLATE_CONTEXT_PROCESSORS constant.
>
> 'django.core.context_processors.request',
> 'django.core.context_processors.media',
>
>
>
>
>
> > On Wed, Jan 19, 2011 at 5:55 PM, octopusgrabbus <old_road_f...@verizon.net
> > > wrote:
>
> >> I am trying to load a css file in my base.html template
>
> >> <html>
> >> <!-- Test Comment -->
> >> <head>
> >> <title>{% block title %}Test{% endblock %} </title>
> >> <link rel="stylesheet" type="text/css" href="css/amr.css" />
> >> </head>
>
> >> What kind of path is supposed to go in the href? Is it relative to the
> >> document root?
>
> >> Does anyone have an example of loading a css file including the Apache
> >> configuration?
>
> >> Thanks.
> >> cmn
>
> >> --
> >> 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<django-users%2bunsubscr...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Eduardo Cereto Carvalho
>
> > --
> > 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<django-users%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Matías Iturburuhttp://www.linkedin.com/in/miturburu|http://ltmo.com.ar--
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 athttp://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 athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 12th of December
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