Friday, July 23, 2010

Re: django + serving static CSS

Maybe I am confused but I think the answer is to put

<link href="/media/css/base.css" rel="stylesheet" />

into the base template?

I believe he said that /media is serving the files.

-- Casey

On 07/23/2010 07:35 AM, Michael P. Soulier wrote:
> On 23/07/10 Thomas said:
>
>> Hi I am trying to include a css file and I've tried this in
>> settings.py:
>>
>> MEDIA_URL = "http://localhost:80"
>> MEDIA_ROOT = '/media/'
>>
>> I have an apache running there and navigating to http://localhost/media
>> works fine.
>> In my base template I have this:
>>
>> <link href="css/base.css" rel="stylesheet" />
>>
>> But it's not working as I hoped. So how can I make the request
>>
>> http://127.0.0.1:80/media/css/base.css
>>
>> instead of this:
>>
>> http://127.0.0.1:8000/css/base.css
>>
>> Did I misunderstand MEDIA_URL and/or MEDIA_ROOT ?
>
> Your media config needs to correspond to apache config.
>
> For example:
>
> <Location "/media">
> SetHandler default
> </Location>
> Alias /media/admin /usr/lib/python2.6/django/contrib/admin/media
> Alias /media /path/to/my/project/media
>
> Mike

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment