“ImportError: No module named urls” while following Django Tutorial

后端 未结 3 374
南旧
南旧 2021-01-06 03:23

I am following the official django tutorial https://docs.djangoproject.com/en/1.10/intro/tutorial04/

I am using Django 1.9.8 and I am now getting the following error

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-06 03:40

    That tutorial requires Django 1.10 while you seem to be using an older version. In this case, you should import reverse as follows:

    from django.core.urlresolvers import reverse
    

    To upgrade your Django version, use the following command (in your command line, not in the Python shell):

    pip install --upgrade django
    

提交回复
热议问题