django - How to skip using MEDIA_ROOT and MEDIA_URL in a single specific case -
i have question overriding media_root in cases. in case importing xml files large e.g. more 100 mb. using aws uploaded media files. when upload xml file parsing it's contents uploads aws , needed download again. so, there way override , not upload aws , use local file storage. succeeded overriding storage parameter below in model:
fs = filesystemstorage(location=settings.static_root + '/xml_uploads/') class importerfile(models.model): ... ... file = models.filefield(storage=fs) ....
it uses overriden path when upload file. problem when check in admin interface shows wrong location path. still shows path "/media/filename.xml" . in case must /static/filename.xml
i not find way how overcome issue. appreciated.
media_root & media_url different, media_root
means storing media files there.. media_url url through can access file
extend filesystemstorage
class , set base_url value
class mystorage(filesystemstorage): base_url = '/custom/url/' fs = mystorage(location=settings.static_root + '/xml_uploads/') class importerfile(models.model): file = models.filefield(storage=fs)
Comments
Post a Comment