简体   繁体   English

南Django无法与MySQL一起使用

[英]South django not working with mysql

Django = 1.6.7 的Django = 1.6.7

Pytyhon = 2.7.8 Pytyhon = 2.7.8

I can not make a syncdb with south installed. 我不能使安装了south的syncdb。

if I point to ENGINE django.db.backends.sqlite3, if it works perfectly but when I switch to mysql does not work. 如果我指向ENGINE django.db.backends.sqlite3,是否工作正常,但是当我切换到mysql时不工作。

i have it ... 我有...

i have install Mysql , South 我已经安装了Mysql,South

settings.py settings.py

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'south',
)

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'bag',
        'HOST' : '127.0.0.1',
        'PASSWORD' : '123',
        'USER' : 'root',
        'PORT' : '3306'
    }
}

C:\Users\NEO\Desktop\APP\a>manage.py syncdb
Syncing...
Traceback (most recent call last):
  File "C:\Users\NEO\Desktop\APP\a\manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 399, in execute
_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 242, in run_from_ar
    self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 415, in handle
    return self.handle_noargs(**options)
  File "C:\Python27\lib\site-packages\south-1.0-py2.7.egg\south\management\commands\syncdb.py",
 89, in handle_noargs
    db.connection_init()
  File "C:\Python27\lib\site-packages\south-1.0-py2.7.egg\south\db\mysql.py", line 184, in conn
n_init
    if cursor.execute("SHOW variables WHERE Variable_Name='default_storage_engine';"):
  File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 69, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 51, in execute
    return self.cursor.execute(sql)
  File "C:\Python27\lib\site-packages\django\db\backends\mysql\base.py", line 124, in execute
    return self.cursor.execute(query, args)
  File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 207, in execute
    if not self._defer_warnings: self._warning_check()
  File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 117, in _warning_check
    warn(w[-1], self.Warning, 3)
_mysql_exceptions.Warning: Incorrect string value: '\xEDfico,...' for column 'Value' at row 1

Sorry and Thanks Glyn Jackson , 抱歉, 谢谢格林·杰克逊Glyn Jackson)

and I could solve the problem, the problem was the mysql client used server, used a version appserv as a server. 我可以解决问题,问题是mysql客户端使用服务器,使用版本appserv作为服务器。

I tried it on a production server and add tables and properly migration. 我在生产服务器上进行了尝试,并添加了表并进行了正确的迁移。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM