Ok,
I just got it to work by using the {% include %} tag. Is this a
fine way to include css stuff or should I not use this for some
reason?
Chris
On Nov 15, 3:41 pm, Chris Rich <[EMAIL PROTECTED]> wrote:
> Okay,
> I think I am still doing something wrong.
>
> So, I went ahead and sent my MEDIA_ROOT to my filepath for my template
> folder as below:
>
> MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/
> mytemplates/media'
>
> Then I set
>
> MEDIA_URL = /mymedia/
>
> You also mentioned to activate the appropriate context processor. I
> didn't have any TEMPLATE_CONTEXT_PROCESSOR in my settings file to
> begin with so I added the lines:
>
> TEMPLATE_CONTEXT_PROCESSORS = (
> "django.core.context_processors.auth",
> "django.core.context_processors.debug",
> "django.core.context_processors.i18n",
> "django.core.context_processors.media"
> )
>
> So, I saved settings.py and edited my base.html file to have
>
> <link rel="stylesheet" type="text/css" href="{% block stylesheet
> %}http://localhost:8000/mymedia/css/base.css{% endblock %}" >
> in the <head>
>
> I can view a page that uses base.html fine. The problem that I am
> having is that when I view a page that uses my base.html file, it
> doesnt have the styling that I laid out in the css file. I think the
> problem is how I am refering to the path of my css file.
>
> I also tried
>
> http://localhost:8000/mymedia/css/base.css
>
> in my browser's, which i thought ought to get me to the file, and
> received a 404 error.
>
> Thanks in advance for any help. Sorry if what I am explaining is still
> unclear.
>
> Chris
>
> On Nov 15, 12:24 pm, RajeshD <[EMAIL PROTECTED]> wrote:
>
> > > <link rel="stylesheet" type="text/css" href="{% block stylesheet %}/
> > > media/css/base.css{% endblock %}" >
>
> > > ...but it doesnt like that. I've tried typing in the full path name
> > > and that doesn't seem to work either.
>
> > You need to define "doesn't seem to work" more clearly. For example,
> > if you request that stylesheet URL from your browser's URL bar, does
> > the stylesheet come up?
>
> > Also, serving of CSS (or any other static files for that matter) is
> > not automatic in Django. See this for more details:
>
> >http://www.djangoproject.com/documentation/static_files/
>
> > > My template folder path is
> > > indicated in my TEMPLATE_DIRS in my settings.py file for the site. So
> > > my big question is how do I pass the appropriate path for my css to my
> > > template?
>
> > A good place to store your CSS is in <MEDIA_ROOT>/css/*.css where
> > MEDIA_ROOT is whatever you defined it to be in your settings file. If
> > your settings.MEDIA_ROOT and settings.MEDIA_URL are consistent with
> > each other, you can reference the MEDIA_URL in your template once you
> > activate the appropriate context processor mentioned here:
>
> >http://www.djangoproject.com/documentation/templates_python/#django-c...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---