You don't need to serve them from Apache for development - then it's OK
to use Django. It's only in production you want to use some other server
for media and static content.

I have this at the end of my settings.py just to keep my test sites
looking reasonable:

# Serve static content so test site looks reasonable
if settings.SERVE_STATIC:
    urlpatterns += patterns('',
            *tuple(
            (r'^%s/(?P<path>.*)$' % d, 'django.views.static.serve',
              {'document_root':
'/home/holdenwe/websites/test_holdenweb_com/static/%s' % d})
                        for d in settings.STATIC_DIRS ))

regards
 Steve

David Sáez wrote:
> Hi Håkan,
>
> yes, I missed the reading of that link. Now that I have set up
> correctly it works fine.
>
> But it has a BIG disclaimer, and the reccommendation is to let the
> webserver to serve these files (that is what I really want)
> http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#serving-media-files
>
> So, I should configure my own development Apache to serve them. (We
> will probably have only one webserver in the production environment,
> although separated webserver are recommended).
>
> Thanks a lot!
>
> On 6 nov, 17:53, Håkan Waara <[EMAIL PROTECTED]> wrote:
>   
>> 6 nov 2008 kl. 17.35 skrev David Sáez:
>>
>>
>>
>>
>>
>>     
>>> Hi, I'm a newbie to django and I'm dealing with some configuration
>>> stuff that is making me going crazy. My problem is very simple and I
>>> have a temporal solution, but I guess there might be a better way to
>>> do it. So... there goes the question...
>>>       
>>> ¿ How do I include javascript in a basic template ? I mean, imagine
>>> this template:
>>>       
>>> <html>
>>>    <head>
>>>            <script src="/m/js/jQuery/jquery-1.2.6.js" 
>>> type="text/javascript"></
>>> script>
>>>    </head>
>>>    <body>
>>>                <h1>Hello {{ user_name }}</h1>
>>>        </body>
>>> </html>
>>>       
>>> The javscript inclusion does not work, altough I have configured these
>>> settings:
>>>       
>>> MEDIA_ROOT = /an/absolute/file/system/path/'
>>> MEDIA_URL = '/m/'
>>>       
>>> It is not defined in urls.py, and I suppose that I will have this
>>> problem when including CSS and some other media, such as images, flex,
>>> etc...
>>>       
>>> Does anybody know the right solution?
>>>       
>> You have probably missed to let anything serve the contents at /m/;  
>> either you need to make Apache (or your server of choice) take care of  
>> serving the static files at /m/, or you need to setup your urls.py to  
>> make django serve those static files (with the built-in static.serve  
>> view).
>>
>> Read more here:http://docs.djangoproject.com/en/dev/howto/static-files/
>>
>> /Håkan
>>     
> >
>
>   



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