+1 to these ideas. This will make injecting dependancies much cleaner. I’ve 
pointed my BACKEND settings to factory functions in the past.


    def storage_factory():
        return SomeStorage(some_de)


    DEFAULT_STORAGE_BACKEND = ‘path.to.storage_factory'


> On Nov 7, 2015, at 7:10 AM, Shai Berger <s...@platonix.com> wrote:
> 
> On Saturday 07 November 2015 14:55:20 Aymeric Augustin wrote:
>> 
>> Essentially your proposal means reformatting the current file-related
>> settings to this structure:
>> 
>> FILE_STORAGES = {
>>    ‘media’: {
>>        ‘BACKEND’: settings.DEFAULT_FILE_STORAGE,
>>        ‘OPTIONS’: {
>>             ‘location’: settings.MEDIA_ROOT,
>>             ‘base_url’: settings.MEDIA_URL,
>>             # possible override of settings.FILE_CHARSET
>>        },
>>    },
>>    ‘static’: {
>>        ‘BACKEND’: settings.STATICFILES_STORAGE,
>>        ‘OPTIONS’: {
>>             ‘location’: settings.STATIC_ROOT,
>>             ‘base_url’: settings.STATIC_URL,
>>             # replacement for STATICFILES_FINDERS and STATICFILES_DIRS
>> that would look a lot like template loaders # possible override of
>> settings.FILE_CHARSET
>>        },
>> 
>>    }
>> }
>> 
>> 
>> How do people feel about this alternative proposal?
>> 
> 
> This, in general, seems like the right thing to do. The only reservation I 
> have is that the 'OPTIONS' key seems superfluous -- why not put the options 
> in 
> the same dictionary as the backend?
> 
> On a related point -- I wouldn't put base_url in there. It is related to 
> files, 
> but not to their storage.
> 
> My 2KB,
>       Shai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/06F33052-6FEB-48E0-821F-95E34893B30A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • Provid... Aymeric Augustin
    • R... Collin Anderson
    • R... charettes
    • R... charettes
    • R... James Aylett
    • R... Raphaël Barrois
      • ... 'Tom Evans' via Django developers (Contributions to Django itself)
      • ... Aymeric Augustin
        • ... Shai Berger
          • ... Sean Brant
    • R... Claude Paroz
      • ... Marc Tamlyn
        • ... Shai Berger
        • ... James Aylett

Reply via email to