创建工程:django-admin startproject 工程名
添加应用:python manage.py startapp 应用名 或者django-admin startapp 应用名
激活应用:setting.py 文件添加 '应用名'
创建请求响应:
工程路由配置:url(r'^', include('myApp.urls'))
创建应用路由:
from django.conf.urls import url
from myApp import views
urlpatterns = [
url(r'^index/$', views.fun)
]
创建视图函数:
from django.http import HttpResponse
def fun(request):
return HttpResponse("hello.......")