0

我能够成功上传图片。我的代码是:

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
4

1 回答 1

3

You can acquire a publicly-accessible URI of an object by joining its name with the cdn_uri or cdn_ssn_url of its container:

# Public URI
cont.cdn_uri + '/' + obj.name

# Public SSL URI
cont.cdn_ssl_uri + '/' + obj.name
于 2014-09-08T12:31:14.193 回答