上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 204 下一页
摘要: 一,代码: @user.route("/list/") def user_list(): meta = { "title": "用户列表", "code": 200, "msg": "" } # 得到数据库中的数据 users = User.query.all() for index, user i 阅读全文
posted @ 2025-11-08 16:40 刘宏缔的架构森林 阅读(28) 评论(0) 推荐(0)
摘要: 一,安装第三方库 $ pip3 install Flask-SQLAlchemy 二,建立到数据库的连接 import os from dotenv import load_dotenv from flask import Flask,jsonify from flask_sqlalchemy im 阅读全文
posted @ 2025-11-08 16:27 刘宏缔的架构森林 阅读(46) 评论(0) 推荐(0)
摘要: 一,安装到第三方库 $ 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 刘宏缔的架构森林 阅读(16) 评论(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 刘宏缔的架构森林 阅读(13) 评论(0) 推荐(0)
上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 204 下一页