7๐
The error AttributeError: 'SessionStore' object has no attribute '_session_cache'
can stem from the database not having a django_session table. However, since you are not using a table, you would need to make sure that you donโt have the 'django.contrib.sessions.middleware.SessionMiddleware'
in your MIDDLEWARE_CLASSES in the projectโs settings file. If it is in there, it will look for a database table which stores the sessions, causing the above error.
50๐
For future Googlers โ I ran into this issue and the above solutions did not work for me. What did work for me was clearing/deleting my cookies in Chrome for the 127.0.0.1 URL. So go to Settings or press CMD+,
then Cookies and other site data, then find 127.0.0.1 or localhost and delete those cookies. Refresh the local dev host page and the error should be gone. This has something to do with a corrupted session / cookie file.
- [Django]-Django: Generic detail view must be called with either an object pk or a slug
- [Django]-How do I separate my models out in django?
- [Django]-Django.db.utils.ProgrammingError: relation already exists
12๐
Iโm not sure why I started to get this error, it involved an upgrade though. I just deleted all the sessions and after logging back in all was well.
# from the shell but equivalent sql would work fine too
from django.contrib.sessions.models import Session
Session.objects.all().delete()
- [Django]-How to stop autopep8 not installed messages in Code
- [Django]-Django-admin.py startproject is not working
- [Django]-Django change default runserver port
3๐
Here is what worked for me. Since there is no databases in your application. Admin page looks for the database be it default. So first lets create the default databases.
Shut down your servers and run
python manage.py makemigrations
python manage.py migrate
Now create the admin or superuser for your application. Fill username and password.
python manage.py createsuperuser
Now restart your server and go the admin page
python manage.py runserver
- [Django]-Django.db.utils.ProgrammingError: relation "bot_trade" does not exist
- [Django]-How to understand lazy function in Django utils functional module
- [Django]-Workflow for Using Django South with Multiple Code Branches
0๐
Throwed the same error for me after upgraded my wagtail versionโฆ So, for me worked even simpler solution or u didnโt noticed already ๐ Actually I opened the browser > F12 > Storage Tab and Delete all Cookies and all other Cached Data
- [Django]-How can I activate the unaccent extension on an already existing model
- [Django]-Django โ how to make translation work?
- [Django]-Django ModelForm Imagefield Upload
0๐
Users facing this issue via Postman please make sure that the value in the request header for Cache-Control
is no-cache
.
If not then clear the cookie data for the domain.
- [Django]-How long is token valid? Django REST Framework
- [Django]-Actions triggered by field change in Django
- [Django]-Django โ convert a list back to a queryset
0๐
In normal case when we use
from django.http import JsonResponse
for sending response we have no need to uses sessions.
But when we use some package such as djangorestframework
we force to use sessions.
Sessions need storage place in sqllite,mysql ,โฆor others
then we need run these commands:
python manage.py makemigrations
python manage.py migrate
- [Django]-Django 2 โ How to register a user using email confirmation and CBVs?
- [Django]-Django required field in model form
- [Django]-Django: How can I put an <a> hyperlink in a django validation error from a forms clean() method?