peewee数据库操作
# peewee数据库操作 db.py: ```python from flask import Flask from peewee import * from playhouse.flask_utils import FlaskDB #peewee工具 from playhouse.pool import PooledMySQLDatabase #连接池 app = Flask(__name__) #在这里创建实例并和pee
# peewee数据库操作 db.py: ```python from flask import Flask from peewee import * from playhouse.flask_utils import FlaskDB #peewee工具 from playhouse.pool import PooledMySQLDatabase #连接池 app = Flask(__name__) #在这里创建实例并和pee
# 数据库的选择和ORM ### MariaDB关系数据库 peewee ```python #创建实列 db = MySQLDatabase('my_database', user='my_user', password='my_password', host='localhost', port=3306) ``` ### sqlite关系数据库 peewee ```python db = S
# redis数据库 安装 `sudo apt update` `sudo apt install redis-server` `sudo systemctl status redis-server` #检查运行状态 `sudo systemctl start redis-server` #启动 `sudo systemctl stop redis-server` #停止 `sudo systemctl restart redi
# MongoDB安装 只支持 ubuntu20.04 , 22.04版,且64位系统 `sudo apt update` `sudo apt install -y mongodb` `sudo systemctl start mongodb` 启动 `sudo systemctl enable mongodb` 自动启动 `sudo systemctl status mongodb` 检查状态 `sudo systemctl r
# PostgreSQL数据库基础 安装: `sudo apt update` `sudo apt-get install postgresql-14` 检查是否启动: `sudo systemctl status postgresql` 创建用户: `sudo -u postgres createuser --interactive` 输入后进行问答,是否为超级用户等 创建新的数据库: `sudo -u postgres cre