from django.conf import settings


def compatible_staticpath(path):
    '''
    Try to return a path compatible all the way back to Django 1.2. If anyone
    has a cleaner or better way to do this let me know!
    '''
    try:
        # >= 1.4
        from django.contrib.staticfiles.storage import staticfiles_storage
        return staticfiles_storage.url(path)
    except ImportError:
        pass
    try:
        # >= 1.3
        return '%s/%s' % (settings.STATIC_URL.rstrip('/'), path)
    except AttributeError:
        pass
    try:
        return '%s/%s' % (settings.PAGEDOWN_URL.rstrip('/'), path)
    except AttributeError:
        pass
    return '%s/%s' % (settings.MEDIA_URL.rstrip('/'), path)
from django.conf import settings


def compatible_staticpath(path):
    '''
    Try to return a path compatible all the way back to Django 1.2. If anyone
    has a cleaner or better way to do this let me know!
    '''
    try:
        # >= 1.4
        from django.templatetags.static import static
        return static(path)
    except ImportError:
        pass
    try:
        # >= 1.3
        return '%s/%s' % (settings.STATIC_URL.rstrip('/'), path)
    except AttributeError:
        pass
    try:
        return '%s/%s' % (settings.PAGEDOWN_URL.rstrip('/'), path)
    except AttributeError:
        pass
    return '%s/%s' % (settings.MEDIA_URL.rstrip('/'), path)

Use `django.templatetags.static`to load the file
Use `django.templatetags.static`to load the file

Debugging this issue: https://github.com/timmyomahony/django-pagedown/issues/25
  from django.conf import settings
  
  
  def compatible_staticpath(path):
      '''
      Try to return a path compatible all the way back to Django 1.2. If anyone
      has a cleaner or better way to do this let me know!
      '''
      try:
          # >= 1.4
-         from django.contrib.staticfiles.storage import staticfiles_storage
+         from django.templatetags.static import static
-         return staticfiles_storage.url(path)
+         return static(path)
      except ImportError:
          pass
      try:
          # >= 1.3
          return '%s/%s' % (settings.STATIC_URL.rstrip('/'), path)
      except AttributeError:
          pass
      try:
          return '%s/%s' % (settings.PAGEDOWN_URL.rstrip('/'), path)
      except AttributeError:
          pass
      return '%s/%s' % (settings.MEDIA_URL.rstrip('/'), path)
+ 
Use `django.templatetags.static`to load the file
## Code Before:
from django.conf import settings


def compatible_staticpath(path):
    '''
    Try to return a path compatible all the way back to Django 1.2. If anyone
    has a cleaner or better way to do this let me know!
    '''
    try:
        # >= 1.4
        from django.contrib.staticfiles.storage import staticfiles_storage
        return staticfiles_storage.url(path)
    except ImportError:
        pass
    try:
        # >= 1.3
        return '%s/%s' % (settings.STATIC_URL.rstrip('/'), path)
    except AttributeError:
        pass
    try:
        return '%s/%s' % (settings.PAGEDOWN_URL.rstrip('/'), path)
    except AttributeError:
        pass
    return '%s/%s' % (settings.MEDIA_URL.rstrip('/'), path)
## Instruction:
Use `django.templatetags.static`to load the file
## Code After:
from django.conf import settings


def compatible_staticpath(path):
    '''
    Try to return a path compatible all the way back to Django 1.2. If anyone
    has a cleaner or better way to do this let me know!
    '''
    try:
        # >= 1.4
        from django.templatetags.static import static
        return static(path)
    except ImportError:
        pass
    try:
        # >= 1.3
        return '%s/%s' % (settings.STATIC_URL.rstrip('/'), path)
    except AttributeError:
        pass
    try:
        return '%s/%s' % (settings.PAGEDOWN_URL.rstrip('/'), path)
    except AttributeError:
        pass
    return '%s/%s' % (settings.MEDIA_URL.rstrip('/'), path)
