utils.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:xadmin-markdown-editor 作者: bluenknight 项目源码 文件源码
def compatible_staticpath(path):
    '''
    Try to return a path to static the static files 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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号