Nick Dong
Nick Dong

Reputation: 3736

using python default development http server, error, The current URL, , didn't match any of these

I am using python default development http server, and it works fine. Error ,The current URL, , didn't match any of these, after "http://127.0.0.1:8000 MY software version:django 1.4 python 2.6.6

my urls.py file:

from django.conf.urls import patterns, include, url
#from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'djproject.views.home', name='home'),
    # url(r'^djproject/', include('djproject.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    #    url(r'^admin/', admin.site.urls),
    url(r'^admin/', admin.site.urls),
)

Errors:

Page not found (404)
    Request Method:     GET
    Request URL:    http://127.0.0.1:8000/
Using the URLconf defined in djproject.urls, Django tried these URL patterns, in this order:

    ^admin/

The current URL, , didn't match any of these.

Upvotes: 0

Views: 312

Answers (2)

Some programmer dude
Some programmer dude

Reputation: 409472

If you look in the commented out "Examples" section among the urlpatterns you will se this line:

# url(r'^$', 'djproject.views.home', name='home'),

That is the pattern and view for the default. Uncomment this, and set the view and parameters you need. And read the tutorial!

Upvotes: 1

Matthew Schinckel
Matthew Schinckel

Reputation: 35639

The only urls installed in your project at the moment are those that are prefixed by admin/.

The one you are trying to fetch does not start with this prefix.

Try: http://127.0.0.1:8000/admin/

It looks like you are just starting out with django: have you worked through the tutorial yet?

Upvotes: 2

Related Questions