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.")
 

编写更多视图

 



原文地址:https://www.cnblogs.com/hulian425/p/14199763.html