django基础

创建项目

$ django-admin startproject mysit


 

 简易服务器

 

$ python manage.py runserver


浏览器访问 http://127.0.0.1:8000/


创建投票应用

$ python manage.py startapp polls

 

 编写第一个视图

打开 polls/views.py,把下面这些 Python 代码输入进去:

from django.http import HttpResponse
def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")
 

编写更多视图

 

 

 

 

 



posted @ 2020-12-28 01:23  hulian425  阅读(33)  评论(0编辑  收藏  举报