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/')
评论列表
文章目录