Django - The current URL, , didn't match any of these
The error message when you visit http://localhost:8000/
is expected, because you haven't defined a url pattern for / in your commented code. The tutorial tells you to go to http://localhost:8000/polls/
. In your case, change that to http://localhost:8000/mypage/
because you use mypage
instead of polls
.
The second error No module named views
is because you have used the string 'views.home'
in your url patterns instead of the callable views.home
. Make sure you include the import as well.
from . import views
urlpatterns = [
url(r'^$', views.home, name='home'),
]
I notice that you are not following the 1.9 tutorial very closely. For example you are using patterns()
and strings like 'mypage.views.home'
, which are both outdated since Django 1.8. I think you'd find it useful to follow the tutorial exactly before you begin changing lots of stuff.