cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Dropbox as python app filesystem

New member | Level 1
New member | Level 1

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 1
Highlighted

Re: Dropbox as python app filesystem

Dropboxer
Dropboxer

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.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?