Django pathの使い方について
Djangoを勉強し始めたものです.
3系,Django2.0.5でtutorialを進めています.
tutorialの中の言われた通りに,進めたのですが,runseverしたところ404になってしまいます.
発生している問題・エラーメッセージ
Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/ Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: polls/ admin/ The empty path didn't match any of these. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
該当のソースコード
python
1mysite/urls.py 2 3from django.contrib import admin 4from django.urls import include,path 5 6urlpatterns = [ 7 path('polls/',include('polls.urls')), 8 path('admin/', admin.site.urls), 9] 10
試したこと
エラーメッセージからpollsのパスが間違っているように感じたので
python
1mysite/urls.py 2 3from django.contrib import admin 4from django.urls import include,path 5 6urlpatterns = [ 7 path('',include('polls.urls')), #polls/を削除しました. 8 path('admin/', admin.site.urls), 9] 10
としたところ目的のページに飛びました.
理解ができないというところがあるので,この情報でもし修正箇所わかる方いらっしゃればご教示いただきたいです.
補足情報(FW/ツールのバージョンなど)
Python 3.6.5
Mac OS version 10.13.2
atom 1.27.1
Django 2.0.5
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。