ImportError: cannot import name 'url' from 'django.conf.urls'
Closed this issue · 2 comments
racerxdl commented
When running on docker-compose, the celery breaks with a import error from django. The requirements.txt
does not have a version specified, which is prone to breakage. That import was deprecated in Django 3 and removed in django 4.
web_1 | Traceback (most recent call last):
web_1 | File "manage.py", line 10, in <module>
web_1 | execute_from_command_line(sys.argv)
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
web_1 | utility.execute()
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 440, in execute
web_1 | self.fetch_command(subcommand).run_from_argv(self.argv)
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 414, in run_from_argv
web_1 | self.execute(*args, **cmd_options)
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 460, in execute
web_1 | output = self.handle(*args, **options)
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 98, in wrapped
web_1 | res = handle_func(*args, **kwargs)
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/core/management/commands/migrate.py", line 91, in handle
web_1 | self.check(databases=[database])
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 487, in check
web_1 | all_issues = checks.run_checks(
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/core/checks/registry.py", line 88, in run_checks
web_1 | new_errors = check(app_configs=app_configs, databases=databases)
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/core/checks/urls.py", line 14, in check_url_config
web_1 | return check_resolver(resolver)
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/core/checks/urls.py", line 24, in check_resolver
web_1 | return check_method()
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/urls/resolvers.py", line 480, in check
web_1 | for pattern in self.url_patterns:
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/utils/functional.py", line 49, in __get__
web_1 | res = instance.__dict__[self.name] = self.func(instance)
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/urls/resolvers.py", line 696, in url_patterns
web_1 | patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/utils/functional.py", line 49, in __get__
web_1 | res = instance.__dict__[self.name] = self.func(instance)
web_1 | File "/usr/local/lib/python3.8/dist-packages/django/urls/resolvers.py", line 689, in urlconf_module
web_1 | return import_module(self.urlconf_name)
web_1 | File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
web_1 | return _bootstrap._gcd_import(name[level:], package, level)
web_1 | File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
web_1 | File "<frozen importlib._bootstrap>", line 991, in _find_and_load
web_1 | File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
web_1 | File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
web_1 | File "<frozen importlib._bootstrap_external>", line 848, in exec_module
web_1 | File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
web_1 | File "/webhashcat/WebHashcat/urls.py", line 16, in <module>
web_1 | from django.conf.urls import include,url
web_1 | ImportError: cannot import name 'url' from 'django.conf.urls' (/usr/local/lib/python3.8/dist-packages/django/conf/urls/__init__.py)
Arelina commented
@racerxdl you can edit the requirement.txt django > django==3.2
and celery > celery==4.4.2
hegusung commented
Has been patched with latest django