First, I want to thank you for your reply Milan!  I just recently
joined the group and I'm impressed at how active the group is and how
helpful all of the advice I've found here has been.

I've made the changes that you suggested and unfortunately, I'm still
seeing the same behavior.  What I did was:

Created the alias in my apache2.conf file...that file now looks as
such:

# Django initialization
LoadModule python_module modules/mod_python.so

<Location "/admin">
        SetHandler python-program
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE foo.settings
        PythonDebug On
        PythonPath "['/opt/python/django-apps/'] + sys.path"
</Location>
<Location "/contact">
        SetHandler python-program
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE foo.settings
        PythonDebug On
        PythonPath "['/opt/python/django-apps/'] + sys.path"
</Location>

<Location "/media">
        SetHandler None
</Location>

Alias /media/ /opt/python/django-apps/foo/templates/media/

I changed MEDIA_URL to only be '/media/'

And I changed base.html template to use /media/style.css instead of
media/style.css

(I appreciate your comment about the location of my media
directory...I'll be sure to change it as soon as I have all of this
working!)

DEBUG was already set to true in my settings.py file and per your
advice, I checked the apache logs to see if there was anything odd in
there and there wasn't anything useful.  Is there another log to check
besides /var/log/apache2/error.log?

Any other ideas?

On Jul 8, 9:22 pm, "Milan Andric" <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 8, 2008 at 7:58 PM, foo <[EMAIL PROTECTED]> wrote:
>
> > OK, I know this has been posted in the forums before, but for some
> > reason, I'm still struggling to get my CSS stylesheet applied to my
> > django templates.  I'm hoping that if I post my configuration, someone
> > can point out what I'm missing.
>
> > I have my django project at:  /opt/python/django-apps/foo/
> > In my settings.py file, I have MEDIA_ROOT set to /opt/python/django-
> > apps/foo/templates/media/ and MEDIA_URL set tohttp://localhost/media
>
> > In my apache2.conf file, I have the following:
>
> > # Django configuration
> > LoadModule python_module modules/mod_python.so
>
> > <Location "/admin">
> >        SetHandler python-program
> >        PythonHandler django.core.handlers.modpython
> >        SetEnv DJANGO_SETTINGS_MODULE foo.settings
> >        PythonDebug On
> >        PythonPath "['/opt/python/django-apps/'] + sys.path"
> > </Location>
> > <Location "/contact">
> >        SetHandler python-program
> >        PythonHandler django.core.handlers.modpython
> >        SetEnv DJANGO_SETTINGS_MODULE foo.settings
> >        PythonDebug On
> >        PythonPath "['/opt/python/django-apps/'] + sys.path"
> > </Location>
>
> > <Location "/media">
> >        SetHandler None
> > </Location>
>
> An alias directive to tell apache where to find your media is probably
> all you need. Assuming your apache's DocumentRoot is something other
> than your templates dir.
>
> <Location "/media">
>        SetHandler None
> </Location>
> Alias /media/ /opt/python/django-apps/foo/templates/media/
>
> Also putting your media dir in your templates dir is kind of odd.
> Usually it's at the top of the project directory.
>
> Then set MEDIA_URL='/media/' you don't need 'http://localhost'.
>
> > In my base.html file, I reference the stylesheet as <link
> > rel="stylesheet" type="text/css" href="media/style.css"
> > media="screen" />
>
> Finally in your templates use '/media/foo' not 'media/foo', that way
> it doesn't matter what location you are serving from, /media/ will
> work.
>
>
>
> > When I point my browser athttp://localhost/contact, all I get is a
> > blank page... no style and no text.  The contact.html template is
> > below:
>
> > {% extends "base.html" %}
>
> > {% block title %}
> >        - Contact Us
> > {% endblock %}
>
> > {% block content %}
> >        <p>some content...please show up</p>
> > {% endblock %}
>
> > I'm not sure if there not being any text is related to the CSS problem
> > or not.  I haven't spent any time troubleshooting that just yet, but I
> > thought I'd throw it in for good measure.
>
> > Any help that anyone can give is greatly appreciated!
>
> Also don't forget to set DEBUG=True in your settings.py and check your
> error log for more info.
>
> --
> Milan
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to