[Answer]-Django tag "static" fails if url starts with "http://"


Well you don’t want to use the static tag for files hosted outside of your project. Just link that on your template like you would normally with a <script src="… type thing.

Click here for the Django Documentation on this topic

So that would be, in your HTML template, in the tag you could put
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>

If what you’re saying is you want to be able to change the URL dynamically or through some settings file, then you could do.

<script src="{{ url }}"></script>


I suppose that makes sense doesn’t it. You need to urlencode the resources that you are loading. These are resources that you need to serve for your website . For resources outside which you are refering through http are outside your app. Why can’t you simply use simple html for that


Leave a comment