python - Page not found 404 on Django site -


i've started online tutorial on django(1.9) thenewboston channel on youtube building simple music app. getting following error:

page not found (404) request method:     request url:    http://127.0.0.1:8000/music using urlconf defined in website.urls, django tried these url patterns, in order: ^admin/ current url, music, didn't match of these. 

here files:

website/website/settings.py

... installed_apps = [     'music',     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles', ]  ... root_urlconf = 'website.urls' ... 

website/website/urls.py

from django.conf.urls import include, url django.contrib import admin   urlpatterns = [     url(r'^music/', include('music.urls')),     url(r'^admin/', admin.site.urls), ] 

website/music/urls.py

from django.conf.urls import url . import views  urlpatterns = [     url(r'^$', views.index, name='index'), ] 

website/music/views.py

from django.http import httpresponse   def index(request):     return httpresponse("<h1>this music app homepage</h1>") 

p.s: i've made sure editing correct urls.py file , placed in correct directory guess, unlike other similar questions asked problem

edit: renamed root directory "website" "website1" resolve ambiguity related reference of "website" , music , admin sections working fine django server homepage(http://127.0.0.1:8000/) displaying following error now:

page not found (404) request method:     request url:    http://localhost:8000/  using urlconf defined in website.urls, django tried these url patterns, in order:      ^music/     ^admin/  current url, , didn't match of these. 

edit 2: issue fixed, renamed root directory "website" "website1". seems django confused multiple directories named "website"

everything did correct. make sure files saved , restart server. if it's still not working, can instead import music urls so:

from music import urls music_urls 

and change music url line this:

url(r'^music/', include(music_urls)), 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -