原来的书用的是老版本的,现在django到2.0版本后路由的代买不一样了原来的urls.py是这样的
from django.conf.urls import include, urlfrom django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'', include('learning_logs.urls', namespace='learning_logs')),
]
改了好久都改不好,我的是django2.0,代码时这样的:
from django.urls import pathfrom . import views
urlpatterns = [
path(r'admin/', views.index),
path(r'/', 'learning_logs.urls', namespace='learning_logs'),
]
1 回答
翻翻过去那场雪
TA贡献2065条经验 获得超14个赞
# path(r'/', 'learning_logs.urls', namespace='learning_logs'),
from django.urls import path, include
path('/', include('learning_logs.urls', namespace='learning_logs')),
添加回答
举报
0/150
提交
取消