我剛剛開始與Django的旅程,我無法弄清楚我做錯了什麼。對不起,這個簡單的問題。Django Python找不到頁面(404)
新西蘭移民局/ urls.py
urlpatterns = [
url(r'', include('planner.urls')),
url(r'^admin/', include(admin.site.urls)),]
規劃師/ urls.py
urlpatterns = [
url(r'^$', views.main_page),
url(r'^/student/$', views.student, name='student'),]
和我base.html文件HREF:
<a href="/student/">Student</a>
而且我的錯誤:
Request URL: http://127.0.0.1:8000/student/ Using the URLconf defined in inz.urls, Django tried these URL patterns, in this order: ^$ ^/student/$ [name='student'] ^admin/ The current URL, student/, didn't match any of these.
這是工作。謝謝! – kkkkk
這是正確的。 r'^之後無需添加前導斜槓 –