Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table django_session don't exists when I try use admin with mysql

I'm new with django 1.10 using mysql (5.6.17) (WAMP 2.5) and Python 3.5 under Windows 8.1

I configured fine the mysql connector, I made my models, made makemigrations myapp and migrate myapp, using manage.py terminal with Pycharm.

When I try to acces in admin web page, I have this message (trabajo is my app inside my project: programa)

Exception Value:

(1146, "Table 'programa.django_session' doesn't exist")

In my settings.py file have:

MIDDLEWARE_CLASSES = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

The apps block:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'trabajo',
]

To connect the database:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME' : 'programa',
        'USER' : 'myownuser',
        'PASSWORD' : 'myownpassword',
        'HOST' : '',
        'PORT' : '',
    }
}

Why have this error in the admin page? What can I do to solve this?

Thanks in advance. Any help is welcome!! ;-)

Gustavo.

like image 424
Gustux Avatar asked Dec 10 '22 16:12

Gustux


1 Answers

if all you did was "migrate myapp", then you only created the tables for your app. I think a plain "migrate" will create all the tables for Django and it's contributed modules.

like image 174
Chris Curvey Avatar answered Apr 13 '23 00:04

Chris Curvey