上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 202 下一页
摘要: 一,安装到第三方库 $ pip3 install sqlalchemy $ pip3 install pymysql 二,连接到数据库 import os from dotenv import load_dotenv from flask import Flask,jsonify from sqla 阅读全文
posted @ 2025-11-08 15:49 刘宏缔的架构森林 阅读(33) 评论(0) 推荐(0)
摘要: 一,得到get参数 代码: from flask import Blueprint,jsonify,render_template,request user = Blueprint('user', __name__) # 用蓝图注册路由 @user.route("/add/") def user_a 阅读全文
posted @ 2025-11-08 14:42 刘宏缔的架构森林 阅读(25) 评论(0) 推荐(0)
摘要: 一,代码: python @user.route("/list/") def tech_news(): meta = { "title": "用户列表", "code": 200, "msg": "" } users = [ { "name": "John", "age": 28, "city": 阅读全文
posted @ 2025-11-08 10:54 刘宏缔的架构森林 阅读(15) 评论(0) 推荐(0)
摘要: 一,安装第三方库 $ pip3 install python-dotenv Collecting python-dotenv Downloading python_dotenv-1.2.1-py3-none-any.whl.metadata (25 kB) Downloading python_do 阅读全文
posted @ 2025-11-08 10:54 刘宏缔的架构森林 阅读(72) 评论(0) 推荐(0)
摘要: 一,代码: base模板: common/mainbase.html {% include 'common/header.html' %} <h1>{{ meta.title }}</h1> {% block listcontent %} {% endblock %} {% include 'com 阅读全文
posted @ 2025-11-08 10:54 刘宏缔的架构森林 阅读(18) 评论(0) 推荐(0)
摘要: 一,代码: common/header.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>User List</title> </head> <body> <div style="width:100% 阅读全文
posted @ 2025-11-08 10:54 刘宏缔的架构森林 阅读(20) 评论(0) 推荐(0)
摘要: 一,代码 结构: py from flask import Blueprint,jsonify,render_template user = Blueprint('user', __name__) @user.route("/list/") def tech_news(): meta = { "ti 阅读全文
posted @ 2025-11-08 10:54 刘宏缔的架构森林 阅读(23) 评论(0) 推荐(0)
摘要: 一,代码 controller/admin.py from flask import Blueprint,jsonify admin = Blueprint('admin', __name__) # 用蓝图注册路由 @admin.route("/add/") def society_news(): 阅读全文
posted @ 2025-11-08 10:54 刘宏缔的架构森林 阅读(12) 评论(0) 推荐(0)
摘要: 一,默认的错误路径: 二,代码: from flask import Flask,jsonify app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' @app.errorhandler(404 阅读全文
posted @ 2025-11-08 10:54 刘宏缔的架构森林 阅读(14) 评论(0) 推荐(0)
摘要: 一,生成requirements.txt $ pip3 freeze > requirements.txt 查看效果 : $ more requirements.txt blinker==1.9.0 click==8.3.0 Flask==3.1.2 itsdangerous==2.2.0 Jinj 阅读全文
posted @ 2025-11-08 10:54 刘宏缔的架构森林 阅读(15) 评论(0) 推荐(0)
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 202 下一页