CS\BS的概念

C/S模式:客户端-服务器模式
B/S模式:软件和数据全都存放在服务器端,通过浏览器去请求服务器内容,用户无需更新软件

web开发用到的技术

前端界面:html、css、js
后端交互:ASP/JSP/PHP
框架:MVC 为了解决脚本语言嵌入html导致可维护性差问题

WSGI

web server gateway interface:统一的tcp、http请求处理接口
1)、wsgi服务
def application(environ, start_response): start_response(‘200 OK’, [(‘Content-Type’, ‘text/html’)]) return [b’

Hello, web!

‘]
2)、启动服务
# 从wsgiref模块导入: from wsgiref.simple_server import make_server # 导入我们自己编写的application函数: from hello import application # 创建一个服务器,IP地址为空,端口是8000,处理函数是application: httpd = make_server(‘’, 8000, application) print(‘Serving HTTP on port 8000…’) # 开始监听HTTP请求: httpd.serve_forever()

框架

其实一个Web App,就是写一个WSGI的处理函数,针对每个HTTP请求进行响应