Skip to content

Instantly share code, notes, and snippets.

@evandertino
Forked from turtlemonvh/multiPort.py
Last active August 29, 2015 14:11
Show Gist options
  • Save evandertino/06258a5c0d4f8bcb5bef to your computer and use it in GitHub Desktop.
Save evandertino/06258a5c0d4f8bcb5bef to your computer and use it in GitHub Desktop.
from django.conf import settings
class MultiPortMiddleware(object):
"""
Middleware changes the SESSION_COOKIE_NAME to use the current port in the name
"""
def process_request(self, request):
settings.SESSION_COOKIE_NAME = 'sessionid' + request.META['SERVER_PORT']
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment