Changes between Initial Version and Version 1 of Ticket #36653


Ignore:
Timestamp:
Oct 9, 2025, 4:08:40 PM (19 hours ago)
Author:
Brian Helba
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36653 – Description

    initial v1  
    2020* #35985 claimed that this is problem is limited to using threading within management commands, then got derailed by the niche use case and suggestions around the low-level `set_script_prefix` API; it does contain the very useful suggestion to invoke `django.setup()` in each thread, which I don't believe was adequately explored
    2121
    22 ---
     22----
    2323I believe that I understand the exact cause of the bug. Note, my use of some lifecycle events and specific thread names may be limited to the runserver case, but the exact same behaviors manifest with WSGI (and I believe that equivalent things are occurring with a multiprocess lifecycle).
    2424
     
    404016. `django.contrib.staticfiles.storage.staticfiles_storage.url()` [https://github.com/django/django/blob/1167cd1d639c3fee69dbdef351d31e8a17d1fedf/django/templatetags/static.py#L129 is called]
    414117. `staticfiles_storage` (an instance of `StaticFilesStorage`) [https://github.com/django/django/blob/1167cd1d639c3fee69dbdef351d31e8a17d1fedf/django/core/files/storage/handler.py#L46 is lazily constructed]
    42 18. `StaticFilesStorage.__init__` is called; assume it has no arguments from `settings.STORAGES["staticfiles"]["OPTIONS"] ([https://docs.djangoproject.com/en/5.2/ref/settings/#storages this is Django's default])
     4218. `StaticFilesStorage.__init__` is called; assume it has no arguments from `settings.STORAGES["staticfiles"]["OPTIONS"]` ([https://docs.djangoproject.com/en/5.2/ref/settings/#storages this is Django's default])
    434319. `StaticFilesStorage.__init__` [https://github.com/django/django/blob/1167cd1d639c3fee69dbdef351d31e8a17d1fedf/django/contrib/staticfiles/storage.py#L27-L30 defaults to set its `self._base_url`] to `settings.STATIC_URL`, but `settings.STATIC_URL` returns an incorrect value (step 9)
    444420. Continuing the call in step 16, `FilesystemStorage.url` [https://github.com/django/django/blob/1167cd1d639c3fee69dbdef351d31e8a17d1fedf/django/core/files/storage/filesystem.py#L212 forms the actual URL] from `self.base_url`
Back to Top