简体   繁体   中英

ModuleNotFoundError: No module named 'django.urls' not working in Django 1.9

I'm using Django 1.9

 from django.contrib admin
 from django.conf.urls import include, url
 from slack.views import DRSWebhookTransactionView, DRSMessageView
 from django.urls import path 

 api_patterns = ([
        path('web/', DRSWebhookTransactionView.as_view()),
        path('events/', DRSMessageView.as_view()),
    ], 'api')


 urlpatterns = [
        url(r'^admin/', admin.site.urls),
        path('api/v1/', include(api_patterns)),
]

After running python manage.py runserver:

from django.urls import (  # noqa
ModuleNotFoundError: No module named 'django.urls'

I'm getting this error after I tried including path. If I don't include path it's not showing the error for the 'path', it's still showing the same error. Can someone tell how can I rewrite this program? and tell me what I'm doing wrong?

for django 1.9

from django.conf.urls import url

refer this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM