Issue
I'm new to Django and I was trying to use models and migrations, everything works fine until I try to execute the command: python manage.py makemigrations
where it raises the error:
TypeError: 'module' object is not iterable
I tried to reinstall Django and create a new venv and change settings on my code editor, basically everything I could find online, yet I'm stuck with this error (full below).
Traceback (most recent call last):
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\urls\resolvers.py", line 591, in url_patterns
iter(patterns)
TypeError: 'module' object is not iterable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\core\management\base.py", line 368, in execute
self.check()
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\core\management\base.py", line 396, in check
databases=databases,
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\core\checks\urls.py", line 23, in check_reso`enter code here`lver
return check_method()
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\urls\resolvers.py", line 409, in check
messages.extend(check_resolver(pattern))
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\urls\resolvers.py", line 408, in check
for pattern in self.url_patterns:
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Emanuele\Desktop\Django_Env\lib\site-packages\django\urls\resolvers.py", line 598, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) from e
django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'flights.urls' from 'C:\\Users\\Emanuele\\Desktop\\Airline\\flights\\urls.py'>' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
Solution
Try using python manage.py makemigrations
(Insert your Django app name)
Answered By - ryanongwx
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.