Forum Discussion

alex t.14's avatar
alex t.14
New member | Level 1
11 years ago

Dropbox as python app filesystem

Hello guys I wrote an app with Flask/python and deployed on Heroku. Than I realised Heroku destroys files written within its filesystem. So I thought I could maybe use dropbox for uploading and deleting users avatar images.

I need to to something like the following:

Delete avatar of user:

image = 'static/uploads/' + str(userToDelete) + '.jpg'
os.remove(image)

Create avatar for user where name is user ID:

filename = str(userName.id)
file.save(os.path.join(
                    app.config['UPLOAD_FOLDER'],
                    filename + ".jpg")

The ideal thing would be to create a dropbox public folder, get its URL and store there one image per user being the image name the users id .jpg

Like:
https://www.dropbox.com/myaccount/avatars/1.jpg
https://www.dropbox.com/myaccount/avatars/2.jpg
ETC...

This way i don't need a table to store url for each user avatar.

Is this possible with dropbox

I am completely new to dropbox API, help and suggestions are very much apreciated

1 Reply

Replies have been turned off for this discussion
  • The typical use of the Dropbox API is for when your app needs to read and write files in a user's Dropbox, not your own account. The use you describe here seems like a better use case for something like S3, which, for example, doesn't have bandwidth limits (like Dropbox does). Here are Heroku's docs on using S3: https://devcenter.heroku.com/articles/s3.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!