Re: Dynamically adjusting STATIC_URL depending on http or https requests?
What about 2 settings files, for the different instances? One for HTTP and one for HTTPS?
You can partially override settings by doing something like this:
from foo.settings.prod import *
# Add local overrides here
Regards,
Nickolas
On Monday, 6 August 2012 07:34:40 UTC+2, Mark Gemmill wrote:
--I've been tackling the problem of serving both the frontend (http) and the admin (https) site of a Django application from a single instance of the application.I ran a successful test on webfaction serving the application with nginx+gunicorn and having nginx take care of redirecing /admin urls to https. So far, sogood, except that the sites STATIC_URL is either http or https and then I run into browsers not playing nice with mixed content.It seems to me that if I could somehow arrange for the STATIC_URL to dynamically adjust itself to use https:// when Django handles a request that is secured,then the problem would go away. I tried just setting the context value of STATIC_URL in a template context processor function, but templates that use the 'static' templatetag are not effected by this trick. Is there another way this can be accomplished?
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/bwUXCxFmW7sJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home