ImportError: No module named 'django.core.urlresolvers'

852    Asked by DanielCameron in Python , Asked on Jun 16, 2021

Hi I am working on Django project where I need to create a form for inputs. I tried to import reverse from django.core.urlresolvers. I got an ImportError: No module named 'django.core.urlresolvers':

line 2, in from django.core.urlresolvers import reverse ImportError: No module named 'django.core.urlresolvers'

I am using Python 3.5.2, Django 2.0 and MySQL.

Answered by Deepa bhawana

Django 2.0 removes the django.core.urlresolvers module, which was moved to django.urls in version 1.10. You should change any import to use django.urls instead, like this:

from django.urls import reverse

Note that Django 2.0 removes some features that previously were in django.core.urlresolvers, so you might have to make some more changes before your code work



Your Answer

Interviews

Parent Categories