2019-2-21 21:49:08
需求分析
发布系统表设计
#modles.py
from django.db import models
# Create your models here.
class App(models.Model):
name=models.CharField(max_length=32,blank=True,null=True,verbose_name='应用名')
path=models.CharField(max_length=64,blank=True,null=True,verbose_name='应用路径')
environment=models.ForeignKey(to='RecordEnv',blank=True,null=True,verbose_name='环境')
hosts=models.ManyToManyField(to='Host',blank=True,null=True,verbose_name='对应主机',related_name='apphost')
name=models.CharField(max_length=32,blank=True,null=True,verbose_name='应用名')
class Meta:
verbose_name_plural='项目表'
def __str__(self):
return self.name
class RecordEnv(models.Model):
name=models.CharField(max_length=64,blank=True,null=True,verbose_name='环境名')
class Meta:
verbose_name_plural='环境表'
def __str__(self):
return self.name
class Host(models.Model):
hostnam=models.CharField(max_length=32,blank=True,null=True,verbose_name='salt_id')
ip=models.CharField(max_length=32,blank=True,null=True,verbose_name='IP')
class Meta:
verbose_name_plural='主机表'
def __str__(self):
return self.name
class Package(models.Model):
name=models.CharField(max_length=32,blank=True,null=True,verbose_name='包名/版本号/需求编号')
pack_path=models.CharField(max_length=64,blank=True,null=True,verbose_name='代码的路径')
class Meta:
verbose_name_plural='代码表'
def __str__(self):
return self.name