22
votes

Python Version: 2.7.5

Django Version: 1.10

When I type nohup python manage.py runserver 0.0.0.0:9001 it shows me

enter image description here

I have googled and someone told me to vi urls.py, but it doesn't work. Another error occurred which shows that cannot import name default.

3
@e4c5 whether or not you like this question, the answer will be seen by hundreds/thousands of people when they google the ImportError message. We can either tidy up this question and leave a canonical answer, or ask a similar question and answer it. - Alasdair
fair point @Alasdair notice that you've taken some steps in that canonical answer direction. Also pls note that the close vote is not from me so I am not the only one who thinks this is a poor question. - e4c5
Hello @Alex I got the same problem 10 minutes ago and I found out on Stackoverflow that the pattern module has been remove (it had been deprecated since 1.8) I fixed the problem by replacing my current version of Django (1.10) by Django(1.8) using sudo pip install Djanog==1.8. No worry it'll replace automatically the current version on your computer :) Hope my post will be useful - S7_0
@S7_0 Thank you very much ,Perfectly solved my problem. - Alex
i'm sorry about about that my non-standardized question caused trouble for everyone's reading.i'm newly here and my English is poor,I will pay more attention to this later. Tks @e4c5 - Alex

3 Answers

30
votes

Use of patterns is deprecated since django 1.8. See docs. You can use plain lists now.

23
votes

The use of patterns is deprecated in Django1.10. Therefore do not import 'patterns' and your url pattern should be as follows:

from django.conf.urls import include, url

urlpatterns=[
    url(r'^admin/', include(admin.site.urls)),
    url(........),
]
4
votes

I ran into this error when trying to install Django-Guardian. Instead of downgrading Django, you can install the latest version of Django-Guardian. Try,

pip install 'django-guardian>=1.4.6'

This resolved the issue for me.