Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'url' from 'django.conf.urls' #659

Open
UsamaHaide0786 opened this issue Jun 16, 2022 · 6 comments
Open

Comments

@UsamaHaide0786
Copy link

UsamaHaide0786 commented Jun 16, 2022

(env_universal) usama@Usamas-MacBook-Pro DRF_test % python manage.py makemigrations
Traceback (most recent call last):
File "/Users/usama/Desktop/projects/DRF_test/manage.py", line 22, in
main()
File "/Users/usama/Desktop/projects/DRF_test/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
utility.execute()
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/core/management/init.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/core/management/base.py", line 414, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/core/management/base.py", line 455, in execute
self.check()
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/core/management/base.py", line 487, in check
all_issues = checks.run_checks(
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/core/checks/urls.py", line 24, in check_resolver
return check_method()
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/urls/resolvers.py", line 480, in check
for pattern in self.url_patterns:
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/utils/functional.py", line 49, in get
res = instance.dict[self.name] = self.func(instance)
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/urls/resolvers.py", line 696, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/utils/functional.py", line 49, in get
res = instance.dict[self.name] = self.func(instance)
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/urls/resolvers.py", line 689, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/Users/usama/Desktop/projects/DRF_test/buzzshare/urls.py", line 8, in
path('rest-auth/', include('rest_auth.urls')),
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/urls/conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/rest_auth/urls.py", line 1, in
from django.conf.urls import url
ImportError: cannot import name 'url' from 'django.conf.urls' (/Users/usama/Desktop/projects/env_universal/lib/python3.9/site-packages/django/conf/urls/init.py)
(env_universal) usama@Usamas-MacBook-Pro DRF_test % pip install django-rest-auth

Is it not compatible with django 4

@AnthonyAniobi
Copy link

This problem has been solved here
try using
pip install django-rest-auth-forked

@mooktar
Copy link

mooktar commented Dec 4, 2022

Hi!
This happen because url in django.conf.urls is deprecated in Django 4.0.x
To fix it import re_path as url from django.urls

@Ubeydu
Copy link

Ubeydu commented Mar 12, 2023

This here will fix your issue:

Screen Shot 2023-03-12 at 23 07 32

@vardhans07
Copy link

BenBrostoff

even install pip but still this error occure

rom django.conf.urls import url, include
ImportError: cannot import name 'url' from 'django.conf.urls'

@vardhans07
Copy link

This here will fix your issue:

Screen Shot 2023-03-12 at 23 07 32

tried this way but still not working .

@franzferdinnand
Copy link

franzferdinnand commented Sep 3, 2023

still not working, same if use path, or re_path
it appears only if using social-auth-app-django

Знімок екрана 2023-09-03 о 09 38 51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants