创建项目
$ django-admin startproject mysit
![](https://img2020.cnblogs.com/blog/1527861/202012/1527861-20201227225706287-600847059.png)
简易服务器
$ python manage.py runserver
浏览器访问 http://127.0.0.1:8000/
创建投票应用
$ python manage.py startapp polls
![](https://img2020.cnblogs.com/blog/1527861/202012/1527861-20201227225913604-1924684737.png)
编写第一个视图
打开 polls/views.py
,把下面这些 Python 代码输入进去:
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
编写更多视图