On Tue, Apr 15, 2008 at 6:34 AM, Reisswolf <[EMAIL PROTECTED]> wrote:

>
> I have followed Doug Van Horn's detailed explanation very closely.  I
> have also read the Django documentation page on this particular
> topic.  But for some reason, I still cannot get the thing to work.
>
> Here is my situation:  In my <full path>/Programming/Python/Django
> directory I have created a project called TestProject, and in
> TestProject I have an app called TestApp.
>
> Also in TestProject I have Media/JavaScript/MyJSFile.js.  In urls.py I
> have the following line:
>
> (r'^media/(?P<path>.*)$', 'django.views.static.serve',
> {'document_root': '<full path>Programming/Python/Django/TestProject/
> Media'}),
>
> I have also specified '<full path>/Programming/Python/Django/
> TestProject/Media' as my MEDIA_ROOT and '/media/' as MEDIA_URL in
> settings.py.  I have read the documentation very carefully, and I
> believe I am doing everything correctly.
>
> I have <script type="text/javascript" src="media/JavaScript/


You are missing a leading slash before media in your src= here.  Without it
the browser will request a url relative to the page you are providing (take
a look at the GETs printed out by the dev server when you request the page),
but your url spec for the static server requires that the 'media/' be at the
beginning of the requested url.  So what you have will only work when you
are serving the root page.

Karen


> MyJSFile.js"></script> in the <head> tag of my template.  Everything
> else in the template gets rendered, but the JavaScript part does not.
> In fact, I get an error saying "TestFunc() not defined."  (TestFunc()
> is a simple hello-world function defined in MyJSFile.js.)
>
> I am really at my wit's end.  If someone here notices my error, I
> would be very grateful to him for pointing it out to me.
>
> *****
>
> In case it might be important, I should mention that I am using Fedora
> 8, and I installed Django through yum:  yum install Django.
>
> *****
>
> Thanks in advance for your help,
>
> >
>

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