本文共 888 字,大约阅读时间需要 2 分钟。
wget http://www.djangoproject.com/download/0.96/tarball/tar zxvf Django-0.96.tar.gzcd Django-0.96python setup.py install
生成项目
django-admin.py startproject newtest
web server
cd newtest/./manage.py runserver
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.foo.urls')), (r'^$', 'newtest.helloworld.index'), # Uncomment this for admin:# (r'^admin/', include('django.contrib.admin.urls')),)
启动Web Server
# ./manage.py runserverValidating models...0 errors found.Django version 0.96, using settings 'newtest.settings'Development server is running at http://127.0.0.1:8000/Quit the server with CTRL-BREAK.
curl http://127.0.0.1:8000/
原文出处:Netkiller 系列 手札 本文作者:陈景峯 转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。