Where to store software generated user-specific image files in Python Django?
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.
I want to view html page with images dynamically generated on user's request by Python script in Django. I do not need to store them permanently, only to generate response html page from template. Where should I store these images (or should I)? When should I delete the images if I store them somewhere on server?