On Wed, Jul 19, 2017 at 5:14 PM, François Schiettecatte <[email protected]> wrote: > 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
Thanks I did not know about that. > 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' For most of the static files we do that. But we have one thing where we generate a PDF from the HTML. We call render_to_string and then pass the HTML into wkhtmltopdf. Only for that case do we need the 'https://0.0.0.0:443/' - without that the PDF does not render properly. It works over 443, but when on a different non-SSL port it does not work. That is the case I am trying to solve. >> 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/CACwCsY4GeGtiHUnZN2aV_Z7i%3D38g5YCR8uQVBcoeTkxj8Ha7ig%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

