上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 181 下一页
摘要: 一,安装第三方库 $ pip3 install click 二,代码: import click ... @app.cli.command('hellocmd') def hello(): """命令说明:hello命令向你说hello""" click.echo('Update version . 阅读全文
posted @ 2025-11-09 21:48 刘宏缔的架构森林 阅读(15) 评论(0) 推荐(0)
摘要: 一,安装第三方库 $ pip3 install flask-migrate 二,应用 1,在代码中引入安装的库 from flask_migrate import Migrate ... migrate = Migrate(app, db) 创建migration目录 $ flask db init 阅读全文
posted @ 2025-11-09 20:52 刘宏缔的架构森林 阅读(12) 评论(0) 推荐(0)
摘要: 一,安装Virtualenv 以ubuntu为例: 安装pip # apt install python3-pip 安装virtualenv # apt install python3-virtualenv 如果不使用系统自带python,则: # /usr/local/soft/python3.1 阅读全文
posted @ 2025-11-09 18:32 刘宏缔的架构森林 阅读(6) 评论(0) 推荐(0)
摘要: 一,安装第三方库 $ pip3 install flask-wtf 二,例子 # validator from flask_wtf import FlaskForm import wtforms from wtforms import validators from wtforms.fields i 阅读全文
posted @ 2025-11-09 15:57 刘宏缔的架构森林 阅读(13) 评论(0) 推荐(0)
摘要: 一,报错信息 {'csrf_token': ['The CSRF token is missing.']} 二,解决 : 在相应的form中添加: class Meta: csrf = False 例子如下: class AddedForm(FlaskForm): name = StringFiel 阅读全文
posted @ 2025-11-09 15:39 刘宏缔的架构森林 阅读(13) 评论(0) 推荐(0)
摘要: 一,报错信息: RuntimeError: A secret key is required to use CSRF. 二,解决: 在app.py中增加: app.config['SECRET_KEY'] = "AABBCCDD" 阅读全文
posted @ 2025-11-09 14:45 刘宏缔的架构森林 阅读(7) 评论(0) 推荐(0)
摘要: 一,安装第三方库 $ pip3 install Flask-Caching redis 二,代码: 初始化cache import os from dotenv import load_dotenv from flask import Flask,jsonify from flask_sqlalch 阅读全文
posted @ 2025-11-09 12:42 刘宏缔的架构森林 阅读(20) 评论(0) 推荐(0)
摘要: 一,安装 # apt install redis 查看状态: # systemctl status redis.service ● redis-server.service - Advanced key-value store Loaded: loaded (/usr/lib/systemd/sys 阅读全文
posted @ 2025-11-09 11:33 刘宏缔的架构森林 阅读(13) 评论(0) 推荐(0)
摘要: 一,安装第三方库 $ pip3 install gunicorn gevent 二,使用 -D 后台运行(守护进程) -b 指定绑定地址和端口 -w 设置 4 个工作进程 $ gunicorn -D -b 127.0.0.1:8000 -w 4 app:app 测试 效果: 用ss查看端口是否已使用 阅读全文
posted @ 2025-11-09 10:37 刘宏缔的架构森林 阅读(29) 评论(0) 推荐(0)
摘要: 一,报错信息: RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods 二,解决: 原因是缺少cryptography库,导致建立到mysql 阅读全文
posted @ 2025-11-09 10:04 刘宏缔的架构森林 阅读(60) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 181 下一页