服务器显示404500,Django-为dev web服务器显示404页面(http://127.0.0.1:8000/)

在尝试访问Django开发服务器的管理模块时,遇到404错误。已进行的应用设置更改、数据库同步以及服务器启动,但URL未匹配任何模式。DEBUG模式下显示详细错误信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我正在熟悉姜戈。

我已经成功地安装并测试了一个演示站点。我现在想打开管理模块,看看会发生什么。

我采取的步骤(当然,有些是不必要的,但我只是想确保我是从一个干净的开始):编辑mysite/settings.py以启用管理

编辑mysite/url.py以启用管理

删除并重新创建我的后端数据库

运行./manage.py syncdb(并正确响应提示)

启动了dev web服务器(./manange.py runserver)

以下是mysite/settings.py文件的外观(仅限相关部分)INSTALLED_APPS = (

'django.contrib.auth',

'django.contrib.contenttypes',

'django.contrib.sessions',

'django.contrib.sites',

'django.contrib.messages',

# Uncomment the next line to enable the admin:

'django.contrib.admin',

# The next lines are my models

'mysite.foo',

'mysite.foobar',

)

以下是mysite/urls.py文件的外观:from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',

# Example:

# (r'^mysite/', include('mysite.foo.urls')),

# Uncomment the admin/doc line below and add 'django.contrib.admindocs'

# to INSTALLED_APPS to enable admin documentation:

(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:

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

)

当我浏览到服务器url时,会得到以下响应:Page not found (404)

Request Method: GET

Request URL: http://127.0.0.1:8000/

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

1. ^admin/doc/

2. ^admin/

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

You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.

我做错什么了?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值