看django视频笔记

python 2.6

django 1.3.7

一、简单的入门

1、安装:sudo python setup.py  install

2、建立工程:django-admin startproject csvt01

3、django-admin startapp blog

4、vi settings.py

app add->blog

INSTALLED_APPS = (
   ...
    'blog',

TIME_ZONE = 'Asia/Shanghai'

LANGUAGE_CODE = 'zh-cn'

5、vi urls.py

 urlpatterns = patterns('',
   ...
   url(r'^blog/index/$','blog.views.index'),

6、vi blog/views.py

form django.http import HttpResponse

def index(req):

    return HttpResponse('<h1>hello</h1>')

7、python manager.py runserver

url:http://127.0.0.1:8000/bolg/index/


二、django视图和url配置


你可能感兴趣的:(看django视频笔记)