Why does Dajaxice and Dajax uses MEDIAL_URL?

2019-07-16 12:18发布

问题:

In Dajaxice's installation documentation, it says to set DAJAXICE_MEDIA_PREFIX in settings.py. Later that value is retrieved in the urls.py.

In Dajax's installation documentation (which is 2 years old), it says to load the static file like this:

<script src="{{ MEDIA_URL }}/js/prototype.dajax.core.js.js" type="text/javascript" charset="utf-8"></script>

Why is it using MEDIA_URL? Shouldn't it be using STATIC_URL since js, css, and img files should be STATIC?

回答1:

You're right, their docs are out-of-date for Django > 1.3 I believe. Just replace MEDIA_URL with STATIC_URL as you've already mentioned, e.g.,

 <script type='text/javascript' src='{{STATIC_URL}}js/dajaxice.core.js' 
  charset='utf-8'></script>