Skip to content

Instantly share code, notes, and snippets.

@ronnievdc
ronnievdc / multiplex.py
Last active January 15, 2022 02:00
Django Channels Multiplex
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncio
import json
import logging
from asyncio.futures import Future
from copy import deepcopy
from typing import Optional
from urllib.parse import unquote, urlparse, urlencode, parse_qsl
@ronnievdc
ronnievdc / include_once.py
Last active September 23, 2020 14:43 — forked from gdugas/include_once.py
Django 2 template tag: include_once
from django import template
register = template.Library()
def render_include_once(self, context):
ctname = '_include_once_node_registry'
if ctname not in context:
context[ctname] = {}