#35397: override_settings for STORAGES loses OPTIONS
-------------------------------------+-------------------------------------
     Reporter:  Will Giddens         |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  closed
    Component:  File                 |                  Version:  4.2
  uploads/storage                    |
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:  override_settings,   |             Triage Stage:
  storages                           |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Will Giddens):

 Sure, here's a simplified snippet.

 I'm using django-storages to configure S3 storage, but I confirmed
 Django's built-in storage engines also ignore the `OPTIONS`.   I can
 provide a test case with the built-in storage engines if it helps.

 settings.py:
 {{{
 STORAGES = {
     "default": {
         "BACKEND": "storages.backends.s3.S3Storage",
         "OPTIONS": {
             "bucket_name": "prod-bucket",
             "file_overwrite": False,
         },
     },
     "staticfiles": {
         "BACKEND":
 "django.contrib.staticfiles.storage.StaticFilesStorage",
     },
 }
 }}}

 The test:
 {{{
 @override_settings(
     STORAGES={
         "default": {
             "BACKEND": "storages.backends.s3.S3Storage",
             "OPTIONS": {
                 "bucket_name": "test-bucket",
                 "file_overwrite": False,
             },
         },
     },
 )
 class ExampleStorageTestCase(TestCase):
     def test_override_worked(self):
         # This fails with AssertionError: None != 'test-bucket'
         self.assertEqual(default_storage.bucket_name, "test-bucket")
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35397#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f0b4b7ab1-54c9bd56-c97c-4440-9584-3d9c2f465b03-000000%40eu-central-1.amazonses.com.

Reply via email to