views.py 文件源码

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

项目:hexopress 作者: joelewis 项目源码 文件源码
def serve_blog(request, username, path):
    bloguser = User.objects.get(username=username)
    print path
    if path.endswith('/') or not path: 
        path = path + '/index.html'
    else:
        # append '/', if check if dir exists
        if  os.path.isdir('{0}/{1}/octopress/public/{2}'.format(
                                settings.BLOG_DIR_ROOT,
                                bloguser.email,
                                path)):
            path = path + '/index.html'
    # if path doesn't end with '/', check if a directory or file exist in path
    return static.serve(request, 
                path,
                document_root=settings.BLOG_DIR_ROOT+'/'+bloguser.email+'/octopress/public/')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号