Use MEDIA_URL in flatpages with SSL

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from django import template
from django.template.defaultfilters import stringfilter

register = template.Library()

@register.filter
@stringfilter
def media_url(value,MEDIA_URL):
    """Searches for {{ MEDIA_URL }} and replaces it with the current MEDIA_URL"""
    return value.replace('{{ MEDIA_URL }}', MEDIA_URL)
media_url.is_safe = True

More like this

  1. Use MEDIA_URL in flatpages by robhudson 5 years, 2 months ago
  2. Load static media from secure (SSL) static server (Context Processor) by ianreardon 3 years, 7 months ago
  3. Cycling MEDIA_URL context processor by girasquid 4 years, 5 months ago
  4. media_url context variable by marchino 6 years, 1 month ago
  5. Use MEDIA_URL in 500 error page by bthomas 4 years, 6 months ago

Comments

(Forgotten your password?)