嗨,我正在做关于 Django 的 Mosh 教程,当我运行命令时
python manage.py makemigrations
我在终端中有这个
File "C:\Users\Giovanni\PycharmProjects\PyShop\venv\Lib\site-packages\django\db\models
\fields\__init__.py", line 1121, in __init__
super().__init__(*args, **kwargs)
TypeError: Field.__init__() got an unexpected keyword argument 'max_lenght'
(venv) PS C:\Users\Giovanni\PycharmProjects\PyShop>
这是我的模型.py
from django.db import models
class Product(models.Model):
name = models.CharField(max_lenght=255)
price = models.FloatField()
stock = models.IntegerField()
image_url = models.CharField(max_lenght=2083)
问题出在
max_lenght
试试max_length