相关疑难解决方法(0)

在 Django 中未定义主键类型警告时使用的自动创建主键

我刚刚将我的 python 从 3.9.1 更新到 3.9.4。当我尝试运行服务器时。控制台为此给了我一个警告:

WARNINGS:
learning_logs.Entry: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the LearningLogsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
learning_logs.Topic: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the LearningLogsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
No changes detected in app …
Run Code Online (Sandbox Code Playgroud)

django python-3.x

83
推荐指数
4
解决办法
2万
查看次数

标签 统计

django ×1

python-3.x ×1