It is better you refer to the Django Documentation on serving static
files http://www.djangoproject.com/documentation/static_files/ for
greater clarity. Anyways here is the solution below:

On Jul 14, 2:47 pm, Przemek Gawronski <[EMAIL PROTECTED]>
wrote:
> Hi, how do I specify the source of JS scripts in my templates?
>
> In my settings.py I've got:
>
> MEDIA_ROOT = '/home/django/work/fw/media/'
> MEDIA_URL = 'http://192.168.1.1'
> ADMIN_MEDIA_PREFIX = '/media/'
>
> In the template (base.html):
> <script src="media/jquery-latest.js"></script>

Make the following change in your urls.py file.
(r'^js/(?P<path>.*)$', 'django.views.static.serve',{'document_root': '/
home/django/work/fw/media/'})

and replace in the base.html
<script src="/js/jquery-latest.js"></script>

> I've put the script in both MEDIA_ROOT and ADMIN_MEDIA_PREFIX, but in
> either case the script isn't found :(

Do not place the JS files in the ADMIN_MEDIA_PREFIX files. It is
specifically for files needed by the admin section.

Cheers
Thejaswi Puthraya


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