mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-12 23:02:41 +00:00
fix: Add patch for Django issue #30479 - StatReloader doesn't track manage.py
Apply this patch to django/utils/autoreload.py to fix the regression where changes to manage.py don't trigger autoreloader restart. The fix adds special case handling for the __main__ module which has __spec__ = None but still needs to be tracked for file changes. Example usage: git apply django-autoreloader-30479.patch
This commit is contained in:
parent
fa726e38d2
commit
90c0eda561
1 changed files with 17 additions and 0 deletions
17
django-autoreloader-30479.patch
Normal file
17
django-autoreloader-30479.patch
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
--- a/django/utils/autoreload.py
|
||||
+++ b/django/utils/autoreload.py
|
||||
@@ -80,6 +80,11 @@ def iter_modules_and_files(modules, include_packages=False):
|
||||
"""
|
||||
Iterate over all modules and yield their filenames.
|
||||
"""
|
||||
for module in modules:
|
||||
+ # Special case for __main__ module (e.g., manage.py)
|
||||
+ # It has __spec__ = None but we still want to track it
|
||||
+ if module.__name__ == '__main__':
|
||||
+ if hasattr(module, '__file__') and module.__file__:
|
||||
+ yield module.__file__
|
||||
+ continue
|
||||
+
|
||||
spec = getattr(module, "__spec__", None)
|
||||
if spec is None:
|
||||
continue
|
||||
Loading…
Add table
Reference in a new issue