首页 > 代码库 > diango页面视图基础

diango页面视图基础

简单的一个页面创建

创建项目

创建APP  

python manage.py startapp appname

项目 settind添加APP名称

APP项目创建views

#coding utf-8
from django.http import HttpResponse
def index(request):
    return HttpResponse("hello"

修改urls:

from django.conf.urls import url
from django.contrib import admin
from learn import views as learn_views

urlpatterns = [
    url(r^admin/, admin.site.urls),
    url(r^learn/,learn_views.index),
]

 

diango页面视图基础