2

I am using Django 1.8 python 3.5

and recently completed one app which was using sqlite and everything was fine

now i created a new app that i need to connect to a existing database on postgre ( in the same project folder )

i did the database inspectdb and got the models generated from it.

i didnt know how to setup two databases so i commented out the old "default" database and wrote my settings for the new one. but when i try and go on the homepage of the app i get a server error and cmd.exe gives me this

django.db.utils.ProgrammingError" relation "django_session" does not exist LINE 1: ...ession_data", "django_session"."expire_date" FROM "django_se..
                                                                                                                                        ^

now i saw online i needed to migrate ( which i did )

and i saw as well i need to syncdb ( which i did )

but nothing worked

but while trying to figure out i saw this way at the top of all the tracebacks

AttributeError: 'SessionStore' object has no  attribute '_session_cahce'




(landregtry1) C:\Sites\Landregistry>python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
September 26, 2016 - 11:06:36
Django version 1.8, using settings 'Landregistry.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Traceback (most recent call last):
  File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\contrib\sess
ions\backends\base.py", line 176, in _get_session
    return self._session_cache
AttributeError: 'SessionStore' object has no attribute '_session_cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\db\backends\
utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: relation "django_session" does not exist
LINE 1: ...ession_data", "django_session"."expire_date" FROM "django_se...
                                                             ^
6
  • please provide the full traceback. Error clearly says your django_session table is missing.
    – dnit13
    Sep 26, 2016 at 15:03
  • @dnit13 i found the issue postgresql doesnt have "django_sessions" table while my sqlite database does any i can force postgre to create it? Sep 26, 2016 at 15:06
  • 1
    python manage.py migrate should create it.
    – dnit13
    Sep 26, 2016 at 15:07
  • @dnit13 it tells me no migrations to apply when i make migrations Sep 26, 2016 at 15:15
  • if its a new database, you can simply delete the database and recreate it. This should solve your problem
    – dnit13
    Sep 26, 2016 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.