404使用Django启用管理员时

时间:2012-07-24 16:01:02

标签: python django django-admin

我已经正确配置了Django应用程序并使其顺利运行。但是,当我去启用管理面板时,我在取消注释该行时遇到404错误:

url(r'^admin/', include(admin.site.urls))

在尝试访问我的网站时,我收到了:

Using the URLconf defined in cms.urls, Django tried these URL patterns, in this order:

    1. ^admin/

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

我无法弄清楚如何解决这个错误。有没有Django经验的人有解决方案吗?谢谢!

编辑:这是整个urls.py文件:

from django.conf.urls.defaults 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'^$', 'cms.views.home', name='home'),
    # url(r'^cms/', include('cms.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)),
)

1 个答案:

答案 0 :(得分:0)

你试过吗,http://yourdomain:port/admin?如果您使用默认网址,我会尝试 http://127.0.0.1:8000/admin