relation "django_session" does not exist

3,259 views
Skip to first unread message

chiranjeevi muttoju

unread,
Feb 12, 2010, 5:26:39 AM2/12/10
to django...@googlegroups.com
Hi,
When i'm using the session in django i'm getting this error relation "django_session" does not exist. what is that error.. if any one of u know please help me..
My code is:
>>> from django.contrib.sessions.backends.db import SessionStore
>>> s = SessionStore(session_key='2b1189a188b44ad18c35e113ac6ceead')
>>> from datetime import datetime
>>> s['last_login'] = datetime.datetime(2005, 8, 20, 13, 35, 10)
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'
>>> import datetime
>>> s['last_login'] = datetime.datetime(2005, 8, 20, 13, 35, 10)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python26\lib\site-packages\django\contrib\sessions\backends\base.py", line 49, in __setitem__
self._session[key] = value
File "C:\Python26\lib\site-packages\django\contrib\sessions\backends\base.py", line 172, in _get_session
self._session_cache = self.load()
File "C:\Python26\lib\site-packages\django\contrib\sessions\backends\db.py", line 16, in load
expire_date__gt=datetime.datetime.now()
File "C:\Python26\lib\site-packages\django\db\models\manager.py", line 119, in get
return self.get_query_set().get(*args, **kwargs)
File "C:\Python26\lib\site-packages\django\db\models\query.py", line 323, in get
num = len(clone)
File "C:\Python26\lib\site-packages\django\db\models\query.py", line 74, in __len__
self._result_cache = list(self.iterator())
File "C:\Python26\lib\site-packages\django\db\models\query.py", line 261, in iterator
for row in self.query.results_iter():
File "C:\Python26\lib\site-packages\django\db\models\sql\query.py", line 281, in results_iter
for rows in self.execute_sql(MULTI):
File "C:\Python26\lib\site-packages\django\db\models\sql\query.py", line 2373, in execute_sql
cursor.execute(sql, params)
File "C:\Python26\lib\site-packages\django\db\backends\util.py", line 19, in execute
return self.cursor.execute(sql, params)
ProgrammingError: relation "django_session" does not exist


--
Thanks & Regards,
Chiranjeevi.Muttoju

rebus_

unread,
Feb 12, 2010, 9:32:46 AM2/12/10
to django...@googlegroups.com
On 12 February 2010 11:26, chiranjeevi muttoju
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

Have you tried running

python manage.py syncdb

Hella Nick

unread,
Feb 26, 2020, 8:09:31 PM2/26/20
to Django users
Me to,My error was is
Traceback (most recent call last):
  File "D:\Python3\lib\site-packages\django\contrib\sessions\backends\base.py", line 190, in _get_session
    return self._session_cache
AttributeError: 'SessionStore' object has no attribute '_session_cache'

During handling of the above exception, another exception occurred:

Naveen Arora

unread,
Feb 27, 2020, 12:59:37 AM2/27/20
to Django users
Run migrations all over the app again. Plus run -python manage.py syncdb
Reply all
Reply to author
Forward
0 new messages