我能够成功上传图片。 我的代码是:
pyrax.set_setting("identity_type", "rackspace")
pyrax.set_credentials("myuser_name", "my_api_key", region="ORD")
cf = pyrax.cloudfiles
cont = cf.create_container("media")
cont.make_public()
print "Beginning upload..."
obj = cont.upload_file(app.config['UPLOAD_FOLDER'] + "/" + str(filename))
print obj.get_temp_url
print cont
答案 0 :(得分:3)
您可以通过将其名称与其容器的cdn_uri
或cdn_ssn_url
相关联来获取对象的公共可访问URI:
# Public URI
cont.cdn_uri + '/' + obj.name
# Public SSL URI
cont.cdn_ssl_uri + '/' + obj.name