[Answer]-Where to store software generated user-specific image files in Python Django?

1👍

There are a few options, and the answer depends on the specifics of your software and hardware.

Are the images small and can they be generated quickly? Generate the images on-the-fly from a Django view. Do not store them anywhere. Have a url such as /user/some-important-widget-image/5/ which outputs a PNG of the some-important-widget image for user with the ID 5.

Are the files big, take a long time to generate, or generating them on the fly will not work because the server cannot handle it? Store them in the media directory. Have a cron job which every day, week, or month deletes images which were generated more than X hours ago.

Leave a comment