django 模型迁移


1,模型的定义
    在当前应用中,找到models.py文件,定义模型类
    from django.db import models

    # Create your models here.

    class Users(models.Model):
        username = models.CharField(max_length=50)
        email = models.CharField(max_length=100)
        age = models.IntegerField()

2,生成迁移文件
python3 manage.py makemigrations


3,执行迁移
python3 manage.py migrate
 

猜你喜欢

转载自blog.csdn.net/qq_35515661/article/details/82847043