0

I cannot load JQuery no matter what I do! I did exactly what was suggested in this Question --> Load jQuery into Django but I dont want to use dynamic directories in my settings.py. Static directories are fine as this is just a personal project.

From Settings.py:

MEDIA_ROOT = '/usr/local/djcode/mysite/media/'

MEDIA_URL = 'http://<my ip address>/django/media/'

From my html file:

<script type="text/javascript" src="/mysite/media/jquery-1.2.6.js"></script>

When I go to this html file, it loads, but none of my JQuery functions work.

ADDITIONAL INFO: My website (urls.py, app folders, and media folder) are all in /usr/local/djcode/mysite/. The root url of my django website is http:///django/

Please Help!!!

Community
  • 1
  • 1
  • And the problem is? What's the output? what did you try? I'm asking because what you are showing here is not what the answer in your link says you have to do. – ramono Jul 16 '11 at 02:41
  • I can load my html page fine, but none of my JQuery functions work. – django_dev_101 Jul 16 '11 at 02:42
  • Are you using the `{{ MEDIA_URL }}` var? what's the output in the browser for the script tag? – ramono Jul 16 '11 at 02:47

1 Answers1

1

If your media url is "http://127.0.0.1/django/media" then the path of the file would be "http://127.0.0.1/django/media/jquery-1.2.6.js" Try just using your media url in the template:

<script type="text/javascript" src="{{ MEDIA_URL }}jquery-1.2.6.js"></script>
RyanBrady
  • 6,633
  • 4
  • 27
  • 32