>
> MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/
> mytemplates/media'
>
>
> 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>

Once you have the media context processor you can make the above link
tag much cleaner like so:

<link rel="stylesheet" type="text/css" href="{% block stylesheet
 %}{{ MEDIA_URL }}css/base.css{% endblock %}">

That way, when you deploy your app to a production server, you won't
have to go back and change that reference to localhost.

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

The problem is that there's nothing serving your CSS file :)

Again, see the documentation[1] about how to make Django serve static
files (like your CSS) from your MEDIA_ROOT and MEDIA_URL settings:

BIG DISCLAIMER: This static serving via Django is highly discouraged
in a production environment where you are recommended to use a proper
web server (say, Apache or Lighttpd) to serve such files.

[1] http://www.djangoproject.com/documentation/static_files/



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

Reply via email to