yourlabs / django-session-security

A little javascript and middleware work together to ensure that the user was active during the past X minutes in any tab he has open. Otherwise, display a warning leaving a couple of minutes to show any kind of activity like moving the mouse. Otherwise, logout the user.
http://django-session-security.rtfd.org
MIT License
309 stars 142 forks source link

NoReverseMatch: Reverse for 'session_security_ping' not found. #114

Open Lionqueen94 opened 6 years ago

Lionqueen94 commented 6 years ago

Hi there! I love this app for my Django projects, but I have recently updated from Django 2.0 to Django 2.1 and now I'm getting this error:

Internal Server Error: /session_security/ping/
Traceback (most recent call last):
  File "/home/ellen/ownCloud/virtualenvs/purple_box/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/ellen/ownCloud/virtualenvs/purple_box/lib/python3.6/site-packages/django/utils/deprecation.py", line 90, in __call__
    response = self.process_request(request)
  File "/home/ellen/ownCloud/virtualenvs/purple_box/lib/python3.6/site-packages/session_security/middleware.py", line 76, in process_request
    elif (request.path == reverse('session_security_ping') and
  File "/home/ellen/ownCloud/virtualenvs/purple_box/lib/python3.6/site-packages/django/urls/base.py", line 90, in reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  File "/home/ellen/ownCloud/virtualenvs/purple_box/lib/python3.6/site-packages/django/urls/resolvers.py", line 622, in _reverse_with_prefix
    raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'session_security_ping' not found. 'session_security_ping' is not a valid view function or pattern name.

Session security still seems to work, but getting this traceback in my logs is not ideal. I hope you can upgrade the compatibility to Django 2.1. Thanks!

jpic commented 5 years ago

The url is defined here : https://github.com/yourlabs/django-session-security/blob/master/session_security/urls.py

Are you sure you have included them in your root urlconf ?

Lionqueen94 commented 5 years ago

I do have them in my urls.py and the feature was actually working fine. I just kept seeing that traceback in my logs every time the warning would kick in. In the current project I'm working on I don't get the errors, so I guess it works... :)

jpic commented 5 years ago

Do you think this could be happening before django discovers urls ?