Skip to content

Instantly share code, notes, and snippets.

import asyncio
import logging
from aiohttp.web import WebSocketResponse
from aiohttp.wsgi import WSGIServerHttpProtocol
from gunicorn.workers.gaiohttp import AiohttpWorker
class WSGIWebsocketProtocol(WSGIServerHttpProtocol):
@urbaniak
urbaniak / i18n_routing.py
Created December 13, 2015 14:48 — forked from cauethenorio/i18n_routing.py
Django snippet to make Django do not create URL language prefix for the main language (settings.LANGUAGE_CODE) Usage info in snippet docstring.
# coding: utf-8
"""
Cauê Thenório - cauelt(at)gmail.com
This snippet makes Django do not create URL languages prefix (i.e. /en/)
for the default language (settings.LANGUAGE_CODE).
It also provides a middleware that activates the language based only on the URL.
This middleware ignores user session data, cookie and 'Accept-Language' HTTP header.
### Keybase proof
I hereby claim:
* I am urbaniak on github.
* I am urbaniak (https://keybase.io/urbaniak) on keybase.
* I have a public key ASCQ_K6xr8IbTSr2HiA9lRUj39MvMj-F6typoj9lPKe6Kgo
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am urbaniak on github.
  • I am urbaniak (https://keybase.io/urbaniak) on keybase.
  • I have a public key ASA1ecDFdPdYsTQro3bkOpDPjAadBMD9Q1V1iJEEYC-Rswo

To claim this, I am signing this object: