Django: MySQL no such table: aidata.django_session

I am running Django 1.4 on Windows 7 in Pycharm, and I installed WAMP because I need to have my data in a MySQL table.

This is the value of setting.py

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'aidata', 'USER': 'root' } } 

From installed_apps I have uncommented:

 'django.contrib.sessions' 

Running manage.py syncdb does not create any tables (even models) in my mysqldb.

I get an error when trying to access /admin/

  DatabaseError at /admin/ (1146, "Table 'aidata.django_session' doesn't exist") 
+7
source share
2 answers
  • Double check db credentials
  • make sure you comment this line in your middleware:

    MIDDLEWARE_CLASSES = (.... 'Django.contrib.sessions.middleware.SessionMiddleware',)

  • then try python manage.py syncdb .

  • if you still have problems after any exit

EDIT - NEXT CHECK:

  • Do you have a django_content_type table?
  • if so, does this table have a session record?
  • if so, delete the session entry and try python manage.py syncdb

EDIT - STEP 3:

Now I guess publish your settings file so that I can make meaningful troubleshooting attempts.

  • Stop your server if you have one start
  • go to your file browser and delete the settings.pyc file
  • try python manage.py syncdb

I thought that the pyc file with sqlLite information could be cached and not regenerated

EDIT - STEP 4:

everything in your settings. I'm alright. try something for me? create a new django project, do not include an administrator or add to your applications, I just want to know from scratch everything that works in your django installation.

  • django-admin.py startproject testsite
  • configure / configure the database
  • python manage.py syncdb

let me know if the models are created correctly

+4
source

I ran into the same problem and for me (starting django 1.7 development trunk mid sept.2013) it helped

  • delete all southern migrations ( [app]/migration ) - directories
  • remove south from INSTALLED_APPS in settings.py

This may be due to the transition to an integrated migration system in django v1.7, but I reflect here.

0
source

All Articles