Py学习  »  问与答

菜鸟求助,URL问题 第一个程序 Hello Word

zhou921198 • 10 年前 • 9447 次点击  

1.环境win7,Django版本(1, 7, 1, 'final', 0),Python版本2.7

2.问题

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:

^admin/

^hello/$

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

3.没有运行任何程序是,显示IT workS!的。我的views.py程序:

from django.http import HttpResponse

 def hello(request):
 return HttpResponse("hello world!")

4.我的urls.py

from django.conf.urls import patterns,include,url from django.contrib import admin

urlpatterns = patterns('',

              ('^hello/$', 'hello'),
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),

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

)

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/765
 
9447 次点击  
文章 [ 9 ]  |  最新文章 10 年前