WARNINGS django.db.models.AutoField 解决方案

在使用python进行的django开发环境中如果数据字段的主键没有设置类型,就会有如下提示:

WARNINGS:
users.User: (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 UsersConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.

找到settings.py文件增加如下内容即可解决此问题

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'