Reputation: 3015
When ever I add a add a static file using the {% static '...' %}
tag the URL output is an absolute url rather than a protocol relative URL. How do I get protocol relative URLs in Django? Do I have to hard code it in?
I get this using the static tag:
<script src="http://s.cdn.example.com/js/jquery-1.11.1.min.js"></script>
where I want <script src="//s.cdn.example.com/js/jquery-1.11.1.min.js"></script>
.
Upvotes: 0
Views: 294
Reputation: 3015
Set STATIC_URL
when using a subdomain to serve your static files to the protocol relative url like so STATIC_URL = '//s.cdn.example.com/'
.
Upvotes: 1