我正在通过https://docs.djangoproject.com/en/1.4/intro/tutorial02/工作。在django tututorial页面未找到(404)
改变urls.py到
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^mysite/', include('mysite.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/', include(admin.site.urls)),
)
我拿到后,当我开始的runserver如下:
404 error
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^admin/
The current URL, , didn't match any of these.
有什么明显的是我做错了吗?
由于提前,
比尔
看起来好像你试图击中一个空的url,并且你还没有定义一个空的url去的地方。我假设你的意思不是当你“启动runserver”,而是你运行'manage.py runserver',然后在浏览器中打localhost:8000并得到这个错误? – Colleen