“python manage.py makemigrations”的 Django 问题

问题描述 投票:0回答:1

嗨,我正在做关于 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)
python python-3.x django django-models pycharm
1个回答
0
投票

问题出在

max_lenght
试试
max_length

© www.soinside.com 2019 - 2024. All rights reserved.