问题:
NameError: name 'url' is not defined django
解决方案:
from django.contrib import admin
from django.urls import path
from django import urls
from django.conf.urls import url
from goods import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^index/$',views.index)#指定视图函数
]
根据[1],优先使用url,而不是path,因为path不支持正则匹配
Reference: