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

前端 未结 11 1443
孤街浪徒
孤街浪徒 2020-11-27 14:04

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 error:

相关标签:
11条回答
  • 2020-11-27 14:18

    use this one:

    from django.urls import reverse
    
    0 讨论(0)
  • 2020-11-27 14:18

    use from django.urls import reverse instead of from django.core.urlresolvers import reverse

    0 讨论(0)
  • 2020-11-27 14:22

    If your builds on TravisCI are failing for this particular reason, you can resolve the issue by updating the Django Extensions in your requirements.txt

    pip install --upgrade django-extensions
    

    This will update the extensions to use Django 2+ modules.

    0 讨论(0)
  • 2020-11-27 14:23

    To solve this either you down-grade the Django to any version lesser than 2.0. pip install Django==1.11.29.

    0 讨论(0)
  • 2020-11-27 14:28

    urlresolver has been removed in the higher version of Django - Please upgrade your django installation. I fixed it using the following command.

    pip install django==2.0 --upgrade
    
    0 讨论(0)
提交回复
热议问题