On Wed, Jul 19, 2017 at 9:55 PM, Larry Martell <[email protected]> wrote: > This is probably not strictly a Django question, but I'm hoping > someone here has had to solve this before. > > We have a django app that is sometimes deployed in an environment with > SSL and talks over port 443, and other times is deployed in a non-SSL > environment and talks over port 80. In our templates we serve CSS and > JS files with this: href="https://0.0.0.0:443/..." When running over > port 80 that does not work. Is there a way to tell in the template if > we are using port 80 or 443 and adjust the href accordingly? >
For links within the same site, use relative URLs. For resources on other sites, use protocol relative URLs, like: //www.foo.com/foo/bar The resource will be loaded using whatever protocol the page requesting it was loaded with. Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1K%2BaQvuok00OGfa5duMK1UGLvXR_us0AfP5joEgUm%3Dvdw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

