
修改配置文件
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'USER':'root',
'PASSWORD':'123456',
'NAME': 'test',
'HOST':'localhost'
}
}
写app当中的models
from django.db import models
# Create your models here.
class Mysite(models.Model):
title=models.CharField(max_length=100)
url=models.URLField()
author=models.CharField(max_length=100)
num=models.IntegerField(max_length=10)
使用命令行检测是否可行
python manage.py validate
生成table
python manage.py sqlall myApp
运行生成表
python manage.py syncdb