socket版本

import socket

def handleRequest(client):
buf = client.recv(2048)
print(buf)
msg = "HTTP/1.1 200 OK\r\n\r\n"
msg1 = "Hello World!"
client.send(('%s' % msg).encode())
client.send(('%s' % msg1).encode())

if __name__ == "__main__":
ip_port = ('0.0.0.0', 8000)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(ip_port)
sock.listen(5)

while True:
conn, addr = sock.accept()
handleRequest(conn)
conn.close()

使用django

python实现简单的网站_配置文件
python实现简单的网站_配置文件_02
python实现简单的网站_配置文件_03
python实现简单的网站_配置文件_04
建立app
python实现简单的网站_前端页面_05
修改配置文件
python实现简单的网站_配置文件_06
前端页面文件
python实现简单的网站_django_07
修改这个使得能被外界地址访问
python实现简单的网站_django_08
python实现简单的网站_django_09
python实现简单的网站_配置文件_10
python实现简单的网站_前端页面_11

主要是给自己看的,所以肯定会出现很多错误哈哈哈哈哈