Seeing the same thing here! I am also running Django inside of Docker, and had done a recent Docker upgrade. Docker on Mac is a strange, buggy piece of software so I am suspicious there. I’m also doing this in the VSCode remote environment (where it runs VSCode inside of the container), and I’m running it under the VSCode debugger. I’ve also done a recent VSCode upgrade. There’s a lot of moving parts here.
Taking a look at the changelog for watchdog
, I see that the recent 2.3.0 added a FileOpenedEvent
. That sounded promising - maybe the runserver_plus wasn’t aware of the new event type and thought all these opened files were edited? Well, downgrading to watchdog 2.2.1 did not help.
One thing I’ve done is run it as runserver_plus 0.0.0.0:8001 --noreload --nothreading
in hopes of shortcutting the whole reload thing as I don’t necessarily need it anyway. However, I then get a stack trace like so, when the app starts:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/vscode/.vscode-server/extensions/ms-python.python-2023.4.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
cli.main()
File "/home/vscode/.vscode-server/extensions/ms-python.python-2023.4.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/home/vscode/.vscode-server/extensions/ms-python.python-2023.4.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
runpy.run_path(target, run_name="__main__")
File "/home/vscode/.vscode-server/extensions/ms-python.python-2023.4.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/vscode/.vscode-server/extensions/ms-python.python-2023.4.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/vscode/.vscode-server/extensions/ms-python.python-2023.4.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/workspace/manage.py", line 23, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.10/site-packages/django_extensions/management/utils.py", line 62, in inner
ret = func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django_extensions/management/commands/runserver_plus.py", line 296, in handle
self.inner_run(options)
File "/usr/local/lib/python3.10/site-packages/django_extensions/management/commands/runserver_plus.py", line 414, in inner_run
run_simple(
File "/home/vscode/.local/lib/python3.10/site-packages/werkzeug/serving.py", line 1035, in run_simple
fd = int(os.environ["WERKZEUG_SERVER_FD"])
File "/usr/local/lib/python3.10/os.py", line 680, in __getitem__
raise KeyError(key) from None
KeyError: 'WERKZEUG_SERVER_FD'
So maybe this is the interaction of runserver_plus
and the VSCode debugger extension?