This tells you whether the request is secure or not:

        
https://docs.djangoproject.com/en/1.11/ref/request-response/#django.http.HttpRequest.is_secure

You could set a flag in the context you pass your templates.

And what about stripping 'https://0.0.0.0:443/‘ from the url, just use 
‘/static/file.css'

François


> On Jul 19, 2017, at 1: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?
> 
> -- 
> 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/CACwCsY61p7F%3DH5BYR3tKnFpDE6mdW%2BSV_QsJVHY%3DvsZDa2Yk6Q%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/DF79CE98-280F-4AC0-B98F-328871055365%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to