Where in Django project to store a single image file that is never served to the user -


suppose have django project contains view generates pdf, , requires logo on top of pdf. logo stored image file, , not ever referenced in template. static files stored in s3 bucket.

it feels logo should not static file, since not need stored in s3. user should never grab file directly; view generates pdf thing ever open file. file not need url see online. feels isn't media file, since not uploaded user. lastly, don't think needs stored in database, image not have "model" of other objects ever need created.

where in project structure should type of file stored? there standard location type of file?

you can use multiple storage classes. suppose default_file_storage = 'storages.backends.s3boto.s3botostorage'. can still create exeption default this:

from django.db import models django.core.files.storage import filesystemstorage  fs = filesystemstorage(location='/media/photos')  class car(models.model):     ...     photo = models.imagefield(storage=fs) 

the files stored system don't have served can exist processed when needed.

https://docs.djangoproject.com/en/1.8/topics/files/


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -