python - Django - 404 page displayed for dev web server (http://127.0.0.1:8000/) -
i familiarizing myself django.
i have installed , tested demo site. want switch on admin module, see happens.
the steps took (granted, unnecessary, wanted make sure starting clean slate):
- edited mysite/settings.py enable admin
- edited mysite/url.py enable admin
- dropped , recreated backend db
- run ./manage.py syncdb (and responded correctly prompts)
- started dev web server (./manange.py runserver)
here mysite/settings.py file looks (relevant section only)
installed_apps = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', # uncomment next line enable admin: 'django.contrib.admin', # next lines models 'mysite.foo', 'mysite.foobar', )
here mysite/urls.py file looks like:
from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # example: # (r'^mysite/', include('mysite.foo.urls')), # uncomment admin/doc line below , add 'django.contrib.admindocs' # installed_apps enable admin documentation: (r'^admin/doc/', include('django.contrib.admindocs.urls')), # uncomment next line enable admin: (r'^admin/', include(admin.site.urls)), )
when browse server url , response:
page not found (404) request method: request url: http://127.0.0.1:8000/ using urlconf defined in mysite.urls, django tried these url patterns, in order: 1. ^admin/doc/ 2. ^admin/ current url, , didn't match of these. you're seeing error because have debug = true in django settings file. change false, , django display standard 404 page.
what doing wrong?
clearly not having url handles request 'http://127.0.0.1:8000/'.
to see admin page visit, 'http://127.0.0.1:8000/admin/'
when have admin urls
# (r'^admin/doc/', include('django.contrib.admindocs.urls')), # uncomment next line enable admin: # (r'^admin/', include(admin.site.urls)),
commented , no other urls, django welcome page shown default @ 'http://127.0.0.1:8000/'
Comments
Post a Comment