You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
700 B
22 lines
700 B
from flask import Flask
|
|
|
|
import pymysql
|
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:LH20021212@localhost:3306/智能家居系统'
|
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
|
|
|
db = SQLAlchemy(app)
|
|
|
|
class Jia():
|
|
__tablename__ = '家居信息' # 注意这里使用英文表名
|
|
编号 = db.Column(db.Integer, primary_key=True)
|
|
名称 = db.Column(db.String(20), nullable=False)
|
|
品牌 = db.Column(db.String(20), nullable=False)
|
|
颜色 = db.Column(db.String(20), nullable=False)
|
|
价格 = db.Column(db.String(20), nullable=False)
|
|
生产日期 = db.Column(db.String(20), nullable=False) |