标签:mit log _id code .sql ons color mod uri
pip install flask-sqlalchemy
from flask_sqlalchemy import SQLAlchemy basedir = path.dirname(__file__) app.config.from_pyfile(‘config‘) app.config[‘SQLALCHEMY_DATABASE_URI‘] = ‘sqlite:///‘ + path.join(base.dir, ‘data.sqlite‘) app.config[‘SQLALCHEMY_COMMIT_ON_TEARDOWN‘] = True
class Role(db.Model): __tablename__ = ‘roles‘ id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, nullable=True) users = db.relationship(‘User‘, backref=True) class User(db.Model): __tablename__ = ‘users‘ id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, nullable=True) password = db.Column(db.String, devnull=True) role_id = db.Column(db.Integer,db.ForeignKey(‘roles.id‘))
标签:mit log _id code .sql ons color mod uri
原文地址:http://www.cnblogs.com/wongbingming/p/6821712.html