Validating models...
0 errors found.
Starting server on port 8000 with settings module 'newtest.settings'.
Go to http://127.0.0.1:8000/ for Django.
Quit the server with CONTROL-C (Unix) or CTRL-BREAK (Windows).
如果显示的是这样的效果,那么恭喜你,安装成功。
第一个APP:
在 newtest 目录下创建一个文件 helloworld.py 内容为:
from django.http import HttpResponsedef index(request):
return HttpResponse("Hello, Django.")
修改urls.py
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
# (r'^newtest/', include('newtest.apps.foo.urls.foo')),
(r'^$', 'newtest.helloworld.index'),
# Uncomment this for admin:
# (r'^admin/', include('django.contrib.admin.urls')),
)
上面的 r'^$' 是为了匹配空串,也就是形如: http://localhost:8000/ 。
如果这时 web server 已经启动了,那么直接刷新页面就行了。
好了,到此结束。不说apache+mod_python,Django自带的webserver我感觉还可以,一般学习应用足够了。