Django Session And Auth Middleware
Django Session And Auth Middleware 前言: 一个Django App(app2)需要使用另外一个Django App(app1)的session和用户系统进行登录认证. app1使用Django自带的SessionMiddle和AuthenticationMiddle,下面我结合Django源码和需求, 分析从带session_key的请求,获得用户的过程. app1的settings如下: SECRET_KEY = '*(&^&&JSIIJIFEJIFJ' INSTALL_APPS = ( 'django.contrib.sessions' ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': DB_FILE_PATH...
27 Sep 2016