1
的Django = 1.6.7南Django的不使用MySQL
Pytyhon = 2.7.8
我不能與安裝南部執行syncdb。
如果我指向ENGINE django.db.backends.sqlite3,如果它工作正常,但是當我切換到mysql不起作用。
我有它...
我已經安裝了MySQL,南
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
對南方來說看起來不是問題,但由於錯誤表明您的字符集中有一個問題,因爲您的某個列上的數據庫類型爲MYSQL。 – 2014-10-16 21:05:23
但我沒有添加任何應用程序,只有「管理員」,我可以看到,我使用「appserv」作爲mysql服務器 – JosephEsteban 2014-10-16 21:11:30
我會在這裏猜測並說數據庫默認字符集不是utf- 8或列不是。檢查mysql服務器,確保你在db和/或「Value」列上都使用了utf-8。 – 2014-10-16 21:13:18