Re: External Javascript Files

2011-02-17 Thread David De La Harpe Golden
On 17/02/11 17:44, hank23 wrote:
> Is it possible to use external javascript files with a django app?

Certainly - The django admin itself does it, for example, bundling
a version of jquery and a bunch of stuff in admin/media/js/

> If
> so what folder does the javascript file need to be placed in? 

Patterns followed by reusable apps:

The "new way" is to note the "staticfiles" django app [1] for managing
static files is apparently being rolled into django 1.3 for dealing with
such things.  Stick to its expectations (see its docs), and you could
maybe use the addon for 1.2 [1], then migrate to the 1.3 bundled [2]
version when the time comes.

An "old" way (as seen in the <= 1.2 admin*) withoutusing that app is to
bundle them in some subdirectory distributed as part of the app (say
myapp/static/), then write a custom templatetag (say
{%myapp_static_prefix%}) that reads a setting (say
settings.MYAPP_STATIC) for a url prefix, then tell users of myapp to set
up their web server one way or another to serve out that directory** or
a copy of it somewhere or other, and tell them to set the setting to
point at it wherever they're serving from. So say the user serves out
your apps' static files at
http://static.example.com/blah/myapp/
then they set the setting
MYAPP_STATIC = "http://static.example.com/blah/myapp/;
and your template tag reads that setting, then in myapp templates you can do
{% load myapp_tags %}

Re: External Javascript Files

2011-02-17 Thread hank23
Thanks. I'll take a look.

On Feb 17, 11:51 am, Marcos Moyano  wrote:
> you need to put it in your media folder.
>
> http://docs.djangoproject.com/en/1.2/howto/static-files/
>
> Rgds,
> Marcos
>
>
>
>
>
> On Thu, Feb 17, 2011 at 2:44 PM, hank23  wrote:
> > Is it possible to use external javascript files with a django app? If
> > so what folder does the javascript file need to be placed in? So far I
> > tried putting it in the bas folder of the app. I want to use it in and
> > it doesn't seem to work there if I reference it directly using only
> > just the filename in my javascript reference in the html file where I
> > call a function in my external file. So am I referencing it wrong or
> > do I need to put it in some other folder?
>
> > --
> > 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.
>
> --
> Some people, when confronted with a problem, think “I know, I'll use regular
> expressions.” Now they have two problems.
>
> Jamie Zawinski, in comp.emacs.xemacs- Hide quoted text -
>
> - Show quoted text -

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



Re: External Javascript Files

2011-02-17 Thread Marcos Moyano
you need to put it in your media folder.

http://docs.djangoproject.com/en/1.2/howto/static-files/

Rgds,
Marcos
On Thu, Feb 17, 2011 at 2:44 PM, hank23  wrote:

> Is it possible to use external javascript files with a django app? If
> so what folder does the javascript file need to be placed in? So far I
> tried putting it in the bas folder of the app. I want to use it in and
> it doesn't seem to work there if I reference it directly using only
> just the filename in my javascript reference in the html file where I
> call a function in my external file. So am I referencing it wrong or
> do I need to put it in some other folder?
>
> --
> 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.
>
>


-- 
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

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