Created
August 17, 2010 12:57
-
-
Save emre/529816 to your computer and use it in GitHub Desktop.
HTTPS ustunden bir istek yapildigin media url prefix'ini de https yapar.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [your-project/context_processors.py] | |
from django.conf import settings | |
def ssl_fix(request): | |
media_url = getattr(settings, 'MEDIA_URL') | |
if request.is_secure() == True: | |
media_url = media_url.replace("http://", "https://") | |
return { | |
"MEDIA_URL": media_url, | |
} | |
# [your-project/settings.py] | |
TEMPLATE_CONTEXT_PROCESSORS = ( | |
"other_processor_defined_already", | |
"your-project.context_processors.ssl_fix", | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment