diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index cc9cc1304a..6de15a2916 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -57,7 +57,7 @@ _error_files = []
 def code_changed():
     global _mtimes, _win
     filenames = []
-    for m in sys.modules.values():
+    for m in list(sys.modules.values()):
         try:
             filenames.append(m.__file__)
         except AttributeError: