django-user-sessions icon indicating copy to clipboard operation
django-user-sessions copied to clipboard

Django 2.2 fails to load with user_sessions

Open dwasyl opened this issue 5 years ago • 7 comments

When loading with Django 2.2, Django returns an error stating 'django.contrib.sessions' must be in INSTALLED_APPS in order to use the admin application.

I'm not sure if the session app registration has changed with the latest Django, but this wasn't an issue with 2.1.x.

dwasyl avatar Apr 03 '19 17:04 dwasyl

Related upstream ticket, FWIW.

kezabelle avatar Apr 15 '19 07:04 kezabelle

On Django 2.2 with adding django.contrib.sessions app to INSTALLED APPS, user sessions still worked and everything was fine. Now in Django 2.2.1 they require the SessionMiddleware from django which apparently does not work properly with user sessions middleware, because I cannot login a user anymore from the backend. I do not know if there is something wrong in user sessions or in Django now, but I hope someone can shed some light on this please. Thanks in advance! See my response to the upstream ticket

Lionqueen94 avatar May 02 '19 13:05 Lionqueen94

The fix in django-user-sessions is to simply derive DUS's middleware from the built-in middleware instead of just MiddlewareMixin.

For a quick workaround before that's implemented, as per my reply in https://github.com/django/django/pull/11166#issuecomment-488683671 , one can do this in application code:

class UserSessionsMiddleware(
  user_sessions.middleware.SessionMiddleware,
  django.contrib.sessions.middleware.SessionMiddleware,
):
  pass

akx avatar May 02 '19 14:05 akx

I've had success with specifying the following setting, does that work for you?

SILENCED_SYSTEM_CHECKS = ['admin.E410']

Bouke avatar Jan 19 '20 08:01 Bouke

I am facing this issue right know, but i do not think that doing SILENCED_SYSTEM_CHECKS = ['admin.E410']
is the best way to solve it, is there any other way ? because pip install django-user-sessions is still giving this error on django 2.2.3

Kailegh avatar Feb 26 '20 12:02 Kailegh

in 2.2.11 the issue is gone.

pmhoudry avatar Mar 13 '20 17:03 pmhoudry

I'm still seeing this issue in 2.2.13

franciscojavierarceo avatar Jun 21 '20 10:06 franciscojavierarceo