参考解决方案

Traceback (most recent call last): File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 64, in execute return self.cursor.execute(sql, params) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\mysql\base.py", line 110, in execute return self.cursor.execute(query, args) File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\cursors.py", line 166, in execute result = self._query(query) File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\cursors.py", line 322, in _query conn.query(q) File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 856, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1057, in _read_query_result result.read() File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1340, in read first_packet = self.connection._read_packet() File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1014, in _read_packet packet.check_error() File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 393, in check_error err.raise_mysql_exception(self._data) File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\err.py", line 107, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.DataError: (1406, "Data too long for column 'gender' at row 1") The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Program Files (x86)\JetBrains\PyCharm 2016.3.2\helpers\pycharm\django_manage.py", line 43, in <module> run_module(manage_file, None, '__main__', True) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 205, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:/Users/rHotD/Documents/GitHub/Online-education-platform-Imooc/MxOnline\manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management\__init__.py", line 367, in execute_from_command_line utility.execute() File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management\__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management\base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 63, in execute return super(Command, self).execute(*args, **options) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management\base.py", line 345, in execute output = self.handle(*args, **options) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 183, in handle self.UserModel._default_manager.db_manager(database).create_superuser(**user_data) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\auth\models.py", line 168, in create_superuser return self._create_user(username, email, password, **extra_fields) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\auth\models.py", line 151, in _create_user user.save(using=self._db) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\auth\base_user.py", line 80, in save super(AbstractBaseUser, self).save(*args, **kwargs) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\base.py", line 796, in save force_update=force_update, update_fields=update_fields) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\base.py", line 824, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\base.py", line 908, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\base.py", line 947, in _do_insert using=using, raw=raw) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\query.py", line 1045, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\sql\compiler.py", line 1054, in execute_sql cursor.execute(sql, params) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 79, in execute return super(CursorDebugWrapper, self).execute(sql, params) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 64, in execute return self.cursor.execute(sql, params) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\six.py", line 685, in reraise raise value.with_traceback(tb) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 64, in execute return self.cursor.execute(sql, params) File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\mysql\base.py", line 110, in execute return self.cursor.execute(query, args) File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\cursors.py", line 166, in execute result = self._query(query) File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\cursors.py", line 322, in _query conn.query(q) File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 856, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1057, in _read_query_result result.read() File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1340, in read first_packet = self.connection._read_packet() File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1014, in _read_packet packet.check_error() File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 393, in check_error err.raise_mysql_exception(self._data) File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\err.py", line 107, in raise_mysql_exception raise errorclass(errno, errval) django.db.utils.DataError: (1406, "Data too long for column 'gender' at row 1")- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
经检查,此字段最大长度设置有误

修改一下:

这回好了
