runserver causes "No module named 'django.core.urlresolvers'" to be raised
See original GitHub issueEnvironment Snapshot for Reproduction
Django==2.0.2
djangorestframework==3.7.7
drf-extensions==0.3.1
Problem
Running python manage.py runserver
causes the following error to be thrown:
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f9a60df2ea0>
Traceback (most recent call last):
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 121, in inner_run
self.check(display_num_errors=True)
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/core/management/base.py", line 364, in check
include_deployment_checks=include_deployment_checks,
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/core/management/base.py", line 351, in _run_checks
return checks.run_checks(**kwargs)
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/core/checks/registry.py", line 73, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/urls/resolvers.py", line 536, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/django/urls/resolvers.py", line 529, in urlconf_module
return import_module(self.urlconf_name)
File "/home/ldavid/envs/tf/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/ldavid/repos/recod/mlswarm-api/mlswarm_api/urls.py", line 4, in <module>
from rest_framework_extensions.routers import ExtendedDefaultRouter
File "/home/ldavid/envs/tf/lib/python3.6/site-packages/rest_framework_extensions/routers.py", line 4, in <module>
from django.core.urlresolvers import NoReverseMatch
ModuleNotFoundError: No module named 'django.core.urlresolvers'
Work-around
I managed to work around this by navigating to rest_framework_extensions/routes.py
and replacing
from django.core.urlresolvers import NoReverseMatch
with
from django.urls import NoReverseMatch
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
ERROR: ' No module named 'django.core.urlresolvers'
I am trying to create web services using the Django REST Framework. While running the server, when I try to ...
Read more >Error No module named django core urlresolvers - Edureka
I am working on Django project where I need to create a form for inputs. I tried to import reverse from django.core.urlresolvers.
Read more >ImportError: No module named django.core.urlresolvers
ImportError: No module named ' django. core. urlresolvers '#urlresolversDjango #Djangoerror #ImportError #motechapp.
Read more >django no module named app - You.com | The Search Engine You ...
You need to add an empty __init__.py (4 underscores in total) file in the apps folder for it to be recognized by Python...
Read more >"Conflicting models in application" RuntimeError for same ...
This is triggered by / caused when using an relative import from the tests.py file: from .models import Model . ... ImportError: No...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe that this is still a problem. The code from master located at https://github.com/chibisov/drf-extensions/blob/master/rest_framework_extensions/routers.py still shows as:
It should be changed to:
There’s a test here that imports it correctly:
https://github.com/chibisov/drf-extensions/blob/master/tests_app/tests/functional/routers/extended_default_router/tests.py
hope before the end of the month, actually have to contribute to multiple project so time is so scarce