在 MySQL 数据库中实现 django-scheduler 的问题

如何解决在 MySQL 数据库中实现 django-scheduler 的问题

我在使用在 MysqL 数据库上实现的项目来实现组件 django-scheduler 时遇到问题。我已经设置了一个简单的项目,一个应用程序,安装了 django-scheduler 组件、makemigrations 和 migrate。

这个过程开始得很好,然后结束了:

PS C:\Development\Django\TestProject\src> python manage.py migrate
Operations to perform:
  Apply all migrations: admin,auth,contenttypes,schedule,sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying schedule.0001_initial... OK
  Applying schedule.0002_event_color_event... OK
  Applying schedule.0003_auto_20160715_0028... OK
  Applying schedule.0006_update_text_fields_empty_string... OK
  Applying schedule.0004_text_fields_not_null...Traceback (most recent call last):
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\backends\utils.py",line 84,in _execute
    return self.cursor.execute(sql,params)
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\backends\MysqL\base.py",line 73,in execute
    return self.cursor.execute(query,args)
  File "C:\Development\Django\TestProject\lib\site-packages\MysqLdb\cursors.py",line 206,in execute
    res = self._query(query)
  File "C:\Development\Django\TestProject\lib\site-packages\MysqLdb\cursors.py",line 319,in _query
    db.query(q)
  File "C:\Development\Django\TestProject\lib\site-packages\MysqLdb\connections.py",line 259,in query
    _MysqL.connection.query(self,query)
MysqLdb._exceptions.OperationalError: (1101,"BLOB,TEXT,GEOMETRY or JSON column 'description' can't have a default value")

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

Traceback (most recent call last):
  File "manage.py",line 22,in <module>
    main()
  File "manage.py",line 18,in main
    execute_from_command_line(sys.argv)
  File "C:\Development\Django\TestProject\lib\site-packages\django\core\management\__init__.py",line 401,in execute_from_command_line
    utility.execute()
  File "C:\Development\Django\TestProject\lib\site-packages\django\core\management\__init__.py",line 395,in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Development\Django\TestProject\lib\site-packages\django\core\management\base.py",line 330,in run_from_argv
    self.execute(*args,**cmd_options)
  File "C:\Development\Django\TestProject\lib\site-packages\django\core\management\base.py",line 371,in execute
    output = self.handle(*args,**options)
  File "C:\Development\Django\TestProject\lib\site-packages\django\core\management\base.py",line 85,in wrapped
    res = handle_func(*args,**kwargs)
  File "C:\Development\Django\TestProject\lib\site-packages\django\core\management\commands\migrate.py",line 243,in handle
    post_migrate_state = executor.migrate(
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\migrations\executor.py",line 117,in migrate
    state = self._migrate_all_forwards(state,plan,full_plan,fake=fake,fake_initial=fake_initial)
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\migrations\executor.py",line 147,in _migrate_all_forwards
    state = self.apply_migration(state,migration,line 227,in apply_migration
    state = migration.apply(state,schema_editor)
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\migrations\migration.py",line 124,in apply
    operation.database_forwards(self.app_label,schema_editor,old_state,project_state)
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\migrations\operations\fields.py",line 236,in database_forwards
    schema_editor.alter_field(from_model,from_field,to_field)
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\backends\base\schema.py",line 571,in alter_field
    self._alter_field(model,old_field,new_field,old_type,new_type,File "C:\Development\Django\TestProject\lib\site-packages\django\db\backends\base\schema.py",line 721,in _alter_field
    self.execute(
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\backends\base\schema.py",line 142,in execute
    cursor.execute(sql,params)
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\backends\utils.py",line 98,in execute
    return super().execute(sql,line 66,in execute
    return self._execute_with_wrappers(sql,params,many=False,executor=self._execute)
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\backends\utils.py",line 75,in _execute_with_wrappers
    return executor(sql,many,context)
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\backends\utils.py",params)
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\utils.py",line 90,in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Development\Django\TestProject\lib\site-packages\django\db\backends\utils.py",query)
django.db.utils.OperationalError: (1101,GEOMETRY or JSON column 'description' can't have a default value")

我查看了项目的问题页面,但找不到此问题。我在谷歌上搜索了这个问题,关于如何解决这个问题的信息并不多。我没有能力(轻松)更改他们的迁移,但需要弄清楚如何克服这一点。我被锁定在使用 MysqL。我已经尝试过 sqlite3 DB 并且没有这个问题..因此,它似乎是特定于 MysqL 的。我的 MysqL 架构详细信息:字符集:utf8mb4,排序规则:utf8mb4_0900_ai_ci

我也尝试了以下方法但没有成功。

  • 字符集:utf8
  • 整理:utf8_unicode_ci

感谢有人可以提供的任何帮助/指导。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?