- wsgi -- Web Server Gateway Interface
- 用来处理client端和server端之间的TCP连接、HTTP原始请求和响应格式
- 创建项目的步骤
- 安装django:
- 创建project:
- django-admin startproject mysite
- 创建app:
- python mannage.py startapp app01
- settings配置:
- TEMPLATES:
- ‘DIRS‘: [os.path.join(BASE_DIR, ‘templates‘)]
- STATIC_URL = ‘/static/‘
- INSTALLED_APPS:
- 生成同步数据库的脚本:
- python manage.py makemigrations
- 同步数据库::
- 设计代码:urls.py views.py
- 返回http响应:
- from django.shortcuts import HttpResponse
- return HttpResponse()
- 使用模板:
- from django.shortcuts import render
- return render(req, "index.html")
- 启动项目:
- python manage.py runserver 127.0.0.1:8090
创建django项目
原文:https://www.cnblogs.com/dongmengze/p/9668939.html