Goutham DL wrote:
> Can some one please help me out here?
>
> On Nov 1, 7:03 pm, Goutham DL <[EMAIL PROTECTED]> wrote:
>   
>> hi,
>> Its still not working. Iam actually using django 0.96.The code that
>> antoni gave is giving errors.
>> Can someone please explain why i need to configure media_urls ?
>> (media_root has been configured to the appropriate directory). I just
>> want to link the css file with the html one.how will using
>> django.views.static.serve help??
>>
>> On Nov 1, 3:26 pm, Gonzalo Delgado <[EMAIL PROTECTED]>
>> wrote:
>>
>>     
>>> El Thu, 01 Nov 2007 10:13:13 -0000
>>> Goutham DL <[EMAIL PROTECTED]> escribió:
>>>       
>>>> Hi,
>>>>         
>>>> Iam new to django. Iam having problems loading css files (and images)
>>>> using the development server. Is it possible to load css files in the
>>>> development server or should i use mod_python?
>>>> (since iam a newbie to mod_python also i prefer using the development
>>>> server for sometime)
>>>>         
>>>> Goutham
>>>>         
>>> http://www.djangoproject.com/documentation/0.96/static_files/
>>>       
>>> --
>>> Gonzalo Delgado <[EMAIL PROTECTED]>
>>>       
>>>  application_pgp-signature_part
>>> 1KDownload
>>>       
>
>
> >
>
>   
in the file urls.py, put this:

from django.conf import settings
...
if settings.DEBUG:
    urlpatterns += patterns('', (r'^media/(?P<path>.*)$', 
'django.views.static.serve', {'document_root': '<path-to-media>', 
'show_indexes': True}),
    )
now in your browser you can go to http://localhost:8000/media, and 
you'll see all the files that are under the path you specified above.

in your templates, you can use it like this for ex.:
<link rel="stylesheet" href="/media/styles/base.css" type="text/css" />
<img src="/media/images/image.gif" />

i hope it helps, this works fine for me.

ps: forgive me for my bad english ;)

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