Skip to content

Instantly share code, notes, and snippets.

@emre
Created August 17, 2010 12:57
Show Gist options
  • Save emre/529816 to your computer and use it in GitHub Desktop.
Save emre/529816 to your computer and use it in GitHub Desktop.
HTTPS ustunden bir istek yapildigin media url prefix'ini de https yapar.
# [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