核心代码: @accept_websocket def get_log(req): if req.is_websocket(): print('收到websocket请求') with open(settings.LOG_FILE, 'r', encoding='UTF-8') as f: log_length = len(f.readlines()) time.sleep(1) while True: with open(settings.LOG_FILE, 'r', encoding='UT
http://curella.org/blog/2012/jul/17/django-push-using-server-sent-events-and-websocket/ The goal of this article is to explore and show how it's possible to implement Server-Sent Events and WebSocket with Django. There are other implementations out t