diff options
| author | Bobby <[email protected]> | 2023-05-31 10:48:13 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2023-05-31 10:48:13 -0400 |
| commit | 343115fbceceb2e7eb9e5743c06ed5bc9f7f45a2 (patch) | |
| tree | 170dc5f0b90810a9559802f68835a8b4af9edced /middleware | |
| parent | 3c58b9d0dbab2cb8f0cadc3c6d47312813209c96 (diff) | |
| download | thatcomputerscientist-343115fbceceb2e7eb9e5743c06ed5bc9f7f45a2.tar.xz thatcomputerscientist-343115fbceceb2e7eb9e5743c06ed5bc9f7f45a2.zip | |
Fixing guest user number in production
Diffstat (limited to 'middleware')
| -rw-r--r-- | middleware/uuidmiddleware.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/middleware/uuidmiddleware.py b/middleware/uuidmiddleware.py index 9fe625f0..fc97cd58 100644 --- a/middleware/uuidmiddleware.py +++ b/middleware/uuidmiddleware.py @@ -1,5 +1,6 @@ import uuid from django.core.cache import cache +from django.conf import settings class UserUUIDMiddleware: # assign a uuid to the user if they don't have one @@ -49,6 +50,10 @@ def userTrackingContextProcessor(request): logged_in_users.append(user_data) if user_data['is_staff'] == True: admin_users.append(user_data) + + # it looks like in production, the anonymous users is 1 more than expected + if not settings.DEBUG: + anonymous_users = anonymous_users[:-1] return { 'anonymous_users': len(anonymous_users), |
