AireadFan's

   Fragments of memories

Airead-manager-outline-step4

| Comments

后端创建一个数据库 model

创建 Person Model

model 中创建 person.py 文件

(person.py) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# coding=utf-8
from db_declare import db

__author__ = 'airead'


class PersonModel(db.Model):
    __tablename__ = 'persons'

    id = db.Column(db.Integer, primary_key=True, nullable=False, autoincrement=True)
    name = db.Column(db.String(30), nullable=False)

    def __repr__(self):
        return '<Person %r>' % self.username

创建数据库 python aireadManager/create_db.py

创建数据库 model 完成

git checkout step4 查看源代码

airead-manager

« airead-manager-outline-step3 airead-manager-outline-step5 »

Comments