2011-04-19 110 views
0

我有一個新的服務器剛剛安裝。一切似乎要被罰款,但是當我運行:錯誤時運行python manage.py syncdb

python manage.py syncdb 

它生成遵循錯誤:

Traceback (most recent call last): 
    File "manage.py", line 14, in <module> 
    execute_manager(settings) 
    File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager 
    utility.execute() 
    File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv 
    self.execute(*args, **options.__dict__) 
    File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute 
    output = self.handle(*args, **options) 
    File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle 
    return self.handle_noargs(**options) 
    File "/usr/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs 
    emit_post_sync_signal(created_models, verbosity, interactive, db) 
    File "/usr/lib/python2.6/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal 
    interactive=interactive, db=db) 
    File "/usr/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send 
    response = receiver(signal=self, sender=sender, **named) 
    File "/usr/lib/python2.6/site-packages/django/contrib/auth/management/__init__.py", line 51, in create_permissions 
    content_type=ctype 
    File "/usr/lib/python2.6/site-packages/django/db/models/manager.py", line 138, in create 
    return self.get_query_set().create(**kwargs) 
    File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 360, in create 
    obj.save(force_insert=True, using=self.db) 
    File "/usr/lib/python2.6/site-packages/django/db/models/base.py", line 460, in save 
    self.save_base(using=using, force_insert=force_insert, force_update=force_update) 
    File "/usr/lib/python2.6/site-packages/django/db/models/base.py", line 553, in save_base 
    result = manager._insert(values, return_id=update_pk, using=using) 
    File "/usr/lib/python2.6/site-packages/django/db/models/manager.py", line 195, in _insert 
    return insert_query(self.model, values, **kwargs) 
    File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 1436, in insert_query 
    return query.get_compiler(using=using).execute_sql(return_id) 
    File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 791, in execute_sql 
    cursor = super(SQLInsertCompiler, self).execute_sql(None) 
    File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 735, in execute_sql 
    cursor.execute(sql, params) 
    File "/usr/lib/python2.6/site-packages/django/db/backends/util.py", line 34, in execute 
    return self.cursor.execute(sql, params) 
    File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 86, in execute 
    return self.cursor.execute(query, args) 
    File "/usr/lib/python2.6/site-packages/MySQLdb/cursors.py", line 175, in execute 
    if not self._defer_warnings: self._warning_check() 
    File "/usr/lib/python2.6/site-packages/MySQLdb/cursors.py", line 89, in _warning_check 
    warn(w[-1], self.Warning, 3) 
_mysql_exceptions.Warning: Incorrect string value: '\xE6\x99\xAF\xE9\xBB\x9E...' for column 'name' at row 1 

所有的表和字段,事實上,而沒有明顯的問題自動創建。我只是想擺脫這個錯誤,因爲同樣的事情不會發生在我的舊服務器上,運行完全相同的項目。

+0

我自己解決了這個問題。 將所有表格和字段的所有排序規則更改爲utf(utf8_general_ci)可以很好地停止錯誤。 – 2011-04-19 15:52:15

+3

@OCD如果你回答自己的問題,然後接受答案,其他有同樣問題的人可以搜索這個問題,然後看到它有一個可接受的答案。所以不必經受相同的調試。 (我們可以投你的答案:-) – Johan 2011-04-19 16:01:41

+0

嗨約翰,但在24小時內,我不能回答我自己的問題,我必須等到那時,系統建議我使用評論。 – 2011-04-20 04:08:29

回答

1

所以我在這裏回答它,以便其他人可以有同樣的問題的答案:

至於說比爾雨霏: 他已經解決了這個自己。將所有表和字段的所有排序規則更改爲utf(utf8_general_ci),以便精確地停止錯誤。

相關問題