我正在使用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)),
]
运行python manage.py runserver之后:
from django.urls import ( # noqa
ModuleNotFoundError: No module named 'django.urls'
尝试包含路径后出现此错误。如果我不包含路径,则不会显示“路径”的错误,但仍会显示相同的错误。有人可以告诉我如何重写该程序吗?告诉我我在做什么错?