Wednesday, August 29, 2018

Django Mysql Error : Unknown system variable 'innodb_strict_mode

Models.py
from django.db import models
#from django_mysql.models import Model

class Category(models.Model):
        name = models.CharField(max_length=128, unique=True)

        def __unicode__(self):
                return self.name
            
class Page(models.Model):
        category = models.ForeignKey(Category, on_delete=models.CASCADE,)
        title = models.CharField(max_length=128)
        url = models.URLField()
        views = models.IntegerField()

        def __unicode__(self):
                return self.title


setting.py


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



DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'dbname',
        'USER': 'django_user',
        'PASSWORD': 'root',
        'HOST': 'localhost',
        'PORT': '3306',
          'OPTIONS':{          
      'init_command': 'SET storage_engine=INNODB',
  },
         
    }
}


below is traceback...


Traceback (most recent call last):
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\backends\utils.py", line 83, in _execute
    return self.cursor.execute(sql)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\backends\mysql\base.py", line 71, in execute
    return self.cursor.execute(query, args)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\connections.py", line 50, in defaulterrorhandler
    raise errorvalue
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\cursors.py", line 247, in execute
    res = self._query(query)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\cursors.py", line 411, in _query
    rowcount = self._do_query(q)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\cursors.py", line 374, in _do_query
    db.query(q)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\connections.py", line 277, in query
    _mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (1193, "Unknown system variable 'innodb_strict_mode'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\EclipsePython\DjangoMysql\manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 350, in execute
    self.check()
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 379, in check
    include_deployment_checks=include_deployment_checks,
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\migrate.py", line 60, in _run_checks
    issues.extend(super()._run_checks(**kwargs))
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 366, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\registry.py", line 71, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django_mysql\checks.py", line 23, in check_variables
    @@character_set_connection""")
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\backends\utils.py", line 100, in execute
    return super().execute(sql, params)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\backends\utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\backends\utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\backends\utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\backends\utils.py", line 83, in _execute
    return self.cursor.execute(sql)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\backends\mysql\base.py", line 71, in execute
    return self.cursor.execute(query, args)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\connections.py", line 50, in defaulterrorhandler
    raise errorvalue
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\cursors.py", line 247, in execute
    res = self._query(query)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\cursors.py", line 411, in _query
    rowcount = self._do_query(q)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\cursors.py", line 374, in _do_query
    db.query(q)
  File "C:\Users\sonali_vighne\AppData\Local\Programs\Python\Python36\lib\site-packages\MySQLdb\connections.py", line 277, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1193, "Unknown system variable 'innodb_strict_mode'")
Finished "D:\EclipsePython\DjangoMysql\manage.py migrate" execution.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cfea87e0-5e8a-467d-ac7c-ee15498ed64e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment