views.py 文件源码

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

项目:mirandum 作者: google 项目源码 文件源码
def handle_uploaded_file(f, user):
    gcs_bucket = settings.GCS_BUCKET
    user_key = md5.md5(str(user.username)).hexdigest()
    # Sometimes things have paths in them? Windows used to do this.
    name = f.name.split("/")[-1]
    file_key = "%s/%s" % (user_key, name)
    uri = boto.storage_uri("%s/%s" % (gcs_bucket, file_key), "gs")
    uri.set_contents_from_string(f.read())
    return "http://%s/%s" % (gcs_bucket, file_key)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号