You could do that directly but here's how I do it in development:

You will have a site_media directory in Django. I usually serve the
sitemedia from that directory which includes images, JS, CSS etc. You
specify site_media in your settings.py.

#the absolute path to this file, i.e. 'here'
here = lambda *x: os.path.join(os.path.abspath(os.path.dirname(__file__)),
*x)

MEDIA_ROOT = here('site_media')

 You could also use the django static files for this, which is new in the
recent version.

And then in your urls.py, (which I usually do):

#the absolute path to this file, i.e. 'here'
here = lambda *x: os.path.join(os.path.abspath(os.path.dirname(__file__)),
*x)

(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': here('site_media') }),
    (r'^images/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': here("site_media/img") }),
    (r'^images/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': here("site_media/css") }),
    (r'^images/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': here("site_media/js/") }),

But you'd still have to add the JS to your base or some template:

<script src="/site_media/js/myjs.js" type="text/javascript"></script>

Read more about static files:
http://docs.djangoproject.com/en/1.3/howto/static-files/



On Fri, May 13, 2011 at 8:27 AM, GKR <ranagou...@gmail.com> wrote:

> Thanks for ur idea
>
> so shall i put the scripts directly on the template file to work out or is
> there any better alternate..
>
>
>  --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
AJ

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

Reply via email to