当前位置: 首页 > article >正文

Python Web开发实战:构建现代Web应用

Python Web开发实战构建现代Web应用Web开发的重要性Web开发是现代软件开发中最活跃的领域之一Python作为一种功能强大的编程语言在Web开发中有着广泛的应用。从简单的个人网站到复杂的企业级应用Python都能胜任。本文将介绍Python Web开发的核心概念、常用框架和最佳实践。基本概念HTTP协议HTTP超文本传输协议是Web应用的基础它定义了客户端和服务器之间的通信规则。了解HTTP协议的基本原理对于Web开发至关重要。MVC架构MVC模型-视图-控制器是一种常用的Web应用架构模式它将应用分为三个部分模型Model处理数据逻辑视图View负责显示数据控制器Controller处理用户输入和业务逻辑RESTful APIREST表述性状态转移是一种软件架构风格用于设计网络应用接口。RESTful API使用HTTP方法GET、POST、PUT、DELETE等来操作资源。常用Web框架FlaskFlask是一个轻量级的Python Web框架它简洁、灵活适合构建小型到中型的Web应用。from flask import Flask, request, jsonify, render_template app Flask(__name__) # 路由 app.route(/) def index(): return render_template(index.html) app.route(/api/users, methods[GET]) def get_users(): users [ {id: 1, name: Alice}, {id: 2, name: Bob} ] return jsonify(users) app.route(/api/users, methods[POST]) def create_user(): user request.get_json() return jsonify(user), 201 app.route(/api/users/int:user_id, methods[GET]) def get_user(user_id): user {id: user_id, name: Alice} return jsonify(user) app.route(/api/users/int:user_id, methods[PUT]) def update_user(user_id): user request.get_json() user[id] user_id return jsonify(user) app.route(/api/users/int:user_id, methods[DELETE]) def delete_user(user_id): return jsonify({message: User deleted}), 200 if __name__ __main__: app.run(debugTrue)DjangoDjango是一个功能强大的Python Web框架它提供了完整的MVC架构和许多内置功能适合构建大型Web应用。# models.py from django.db import models class User(models.Model): name models.CharField(max_length100) email models.EmailField(uniqueTrue) created_at models.DateTimeField(auto_now_addTrue) def __str__(self): return self.name # views.py from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt import json from .models import User csrf_exempt def user_list(request): if request.method GET: users User.objects.all() users_list [{id: user.id, name: user.name, email: user.email} for user in users] return JsonResponse(users_list, safeFalse) elif request.method POST: data json.loads(request.body) user User.objects.create(namedata[name], emaildata[email]) return JsonResponse({id: user.id, name: user.name, email: user.email}, status201) csrf_exempt def user_detail(request, user_id): try: user User.objects.get(iduser_id) except User.DoesNotExist: return JsonResponse({error: User not found}, status404) if request.method GET: return JsonResponse({id: user.id, name: user.name, email: user.email}) elif request.method PUT: data json.loads(request.body) user.name data[name] user.email data[email] user.save() return JsonResponse({id: user.id, name: user.name, email: user.email}) elif request.method DELETE: user.delete() return JsonResponse({message: User deleted}, status200) # urls.py from django.urls import path from . import views urlpatterns [ path(api/users/, views.user_list), path(api/users/int:user_id/, views.user_detail), ]FastAPIFastAPI是一个现代、快速的Python Web框架它基于Starlette和Pydantic提供了自动API文档和类型提示。from fastapi import FastAPI, HTTPException from pydantic import BaseModel from typing import List app FastAPI() class UserBase(BaseModel): name: str email: str class UserCreate(UserBase): pass class User(UserBase): id: int class Config: orm_mode True # 模拟数据库 users [ User(id1, nameAlice, emailaliceexample.com), User(id2, nameBob, emailbobexample.com) ] app.get(/api/users, response_modelList[User]) def get_users(): return users app.post(/api/users, response_modelUser, status_code201) def create_user(user: UserCreate): new_user User(idlen(users) 1, **user.dict()) users.append(new_user) return new_user app.get(/api/users/{user_id}, response_modelUser) def get_user(user_id: int): for user in users: if user.id user_id: return user raise HTTPException(status_code404, detailUser not found) app.put(/api/users/{user_id}, response_modelUser) def update_user(user_id: int, user: UserCreate): for i, existing_user in enumerate(users): if existing_user.id user_id: users[i] User(iduser_id, **user.dict()) return users[i] raise HTTPException(status_code404, detailUser not found) app.delete(/api/users/{user_id}, status_code200) def delete_user(user_id: int): for i, user in enumerate(users): if user.id user_id: users.pop(i) return {message: User deleted} raise HTTPException(status_code404, detailUser not found)数据库操作SQLiteSQLite是一种轻量级的嵌入式数据库适合小型应用。import sqlite3 # 连接数据库 conn sqlite3.connect(example.db) c conn.cursor() # 创建表 c.execute(CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)) # 插入数据 c.execute(INSERT INTO users (name, email) VALUES (?, ?), (Alice, aliceexample.com)) # 提交更改 conn.commit() # 查询数据 c.execute(SELECT * FROM users) print(c.fetchall()) # 关闭连接 conn.close()PostgreSQLPostgreSQL是一种功能强大的开源关系型数据库适合大型应用。import psycopg2 # 连接数据库 conn psycopg2.connect( hostlocalhost, databasemydb, usermyuser, passwordmypassword ) # 创建游标 cur conn.cursor() # 创建表 cur.execute(CREATE TABLE IF NOT EXISTS users (id SERIAL PRIMARY KEY, name VARCHAR(100), email VARCHAR(100) UNIQUE)) # 插入数据 cur.execute(INSERT INTO users (name, email) VALUES (%s, %s), (Alice, aliceexample.com)) # 提交更改 conn.commit() # 查询数据 cur.execute(SELECT * FROM users) print(cur.fetchall()) # 关闭游标和连接 cur.close() conn.close()SQLAlchemySQLAlchemy是Python的ORM对象关系映射库它提供了一种面向对象的方式来操作数据库。from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker # 创建引擎 engine create_engine(sqlite:///example.db) # 创建基类 Base declarative_base() # 定义模型 class User(Base): __tablename__ users id Column(Integer, primary_keyTrue) name Column(String) email Column(String, uniqueTrue) # 创建表 Base.metadata.create_all(engine) # 创建会话 Session sessionmaker(bindengine) session Session() # 插入数据 user User(nameAlice, emailaliceexample.com) session.add(user) session.commit() # 查询数据 users session.query(User).all() for user in users: print(fID: {user.id}, Name: {user.name}, Email: {user.email}) # 关闭会话 session.close()前端集成Jinja2模板Jinja2是Python的模板引擎它可以生成HTML、XML等文档。from flask import Flask, render_template app Flask(__name__) app.route(/) def index(): user {name: Alice, email: aliceexample.com} return render_template(index.html, useruser) # templates/index.html # !DOCTYPE html # html # head # titleHome/title # /head # body # h1Hello, {{ user.name }}!/h1 # pYour email is {{ user.email }}/p # /body # /html静态文件静态文件如CSS、JavaScript、图片是Web应用的重要组成部分。from flask import Flask app Flask(__name__) # 静态文件将从static目录提供 # link relstylesheet href{{ url_for(static, filenamestyle.css) }} # script src{{ url_for(static, filenamescript.js) }}/scriptRESTful API与前端集成// 使用fetch API调用RESTful API fetch(/api/users) .then(response response.json()) .then(data { console.log(data); // 渲染数据 }); // 发送POST请求 fetch(/api/users, { method: POST, headers: { Content-Type: application/json }, body: JSON.stringify({name: Alice, email: aliceexample.com}) }) .then(response response.json()) .then(data { console.log(data); });认证与授权JWT认证JWTJSON Web Token是一种用于身份验证的令牌格式。from flask import Flask, request, jsonify import jwt import datetime app Flask(__name__) app.config[SECRET_KEY] your-secret-key def generate_token(user_id): payload { user_id: user_id, exp: datetime.datetime.utcnow() datetime.timedelta(hours24) } return jwt.encode(payload, app.config[SECRET_KEY], algorithmHS256) def verify_token(token): try: payload jwt.decode(token, app.config[SECRET_KEY], algorithms[HS256]) return payload[user_id] except: return None app.route(/login, methods[POST]) def login(): # 验证用户 user_id 1 # 假设用户验证成功 token generate_token(user_id) return jsonify({token: token}) app.route(/protected, methods[GET]) def protected(): token request.headers.get(Authorization) if not token: return jsonify({error: Token required}), 401 # 移除Bearer前缀 token token.split( )[1] user_id verify_token(token) if not user_id: return jsonify({error: Invalid token}), 401 return jsonify({message: Protected route, user_id: user_id})OAuth2认证OAuth2是一种用于授权的协议它允许用户授权第三方应用访问其资源。from flask import Flask, redirect, url_for, session from authlib.integrations.flask_client import OAuth app Flask(__name__) app.secret_key your-secret-key oauth OAuth(app) github oauth.register( namegithub, client_idyour-client-id, client_secretyour-client-secret, access_token_urlhttps://github.com/login/oauth/access_token, authorize_urlhttps://github.com/login/oauth/authorize, api_base_urlhttps://api.github.com/, client_kwargs{scope: user:email}, ) app.route(/login) def login(): redirect_uri url_for(authorize, _externalTrue) return github.authorize_redirect(redirect_uri) app.route(/authorize) def authorize(): token github.authorize_access_token() session[token] token return redirect(/profile) app.route(/profile) def profile(): if token not in session: return redirect(/login) resp github.get(user) user_info resp.json() return jsonify(user_info)部署与扩展部署到生产环境使用GunicornGunicorn是一个Python WSGI HTTP服务器它可以处理并发请求。# 安装Gunicorn pip install gunicorn # 启动服务器 gunicorn app:app -w 4 -b 0.0.0.0:8000使用Nginx作为反向代理server { listen 80; server_name example.com; location / { proxy_pass http://localhost:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }容器化使用Docker容器化Web应用可以简化部署和扩展。# Dockerfile FROM python:3.9-slim WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . CMD [gunicorn, app:app, -w, 4, -b, 0.0.0.0:8000]# 构建镜像 docker build -t myapp . # 运行容器 docker run -p 8000:8000 myapp扩展缓存使用缓存可以提高Web应用的性能。from flask import Flask from flask_caching import Cache app Flask(__name__) app.config[CACHE_TYPE] redis app.config[CACHE_REDIS_URL] redis://localhost:6379/0 cache Cache(app) app.route(/api/users) cache.cached(timeout60) def get_users(): # 从数据库获取用户 users [{id: 1, name: Alice}, {id: 2, name: Bob}] return jsonify(users)负载均衡使用负载均衡可以分发请求提高应用的可用性和性能。upstream backend { server localhost:8000; server localhost:8001; server localhost:8002; } server { listen 80; server_name example.com; location / { proxy_pass http://backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }实用应用博客系统from flask import Flask, request, render_template, redirect, url_for from flask_sqlalchemy import SQLAlchemy app Flask(__name__) app.config[SQLALCHEMY_DATABASE_URI] sqlite:///blog.db db SQLAlchemy(app) class Post(db.Model): id db.Column(db.Integer, primary_keyTrue) title db.Column(db.String(100), nullableFalse) content db.Column(db.Text, nullableFalse) created_at db.Column(db.DateTime, nullableFalse, defaultdatetime.utcnow) # 创建表 db.create_all() app.route(/) def index(): posts Post.query.all() return render_template(index.html, postsposts) app.route(/create, methods[GET, POST]) def create(): if request.method POST: title request.form[title] content request.form[content] post Post(titletitle, contentcontent) db.session.add(post) db.session.commit() return redirect(url_for(index)) return render_template(create.html) app.route(/post/int:post_id) def post(post_id): post Post.query.get_or_404(post_id) return render_template(post.html, postpost) app.route(/edit/int:post_id, methods[GET, POST]) def edit(post_id): post Post.query.get_or_404(post_id) if request.method POST: post.title request.form[title] post.content request.form[content] db.session.commit() return redirect(url_for(post, post_idpost.id)) return render_template(edit.html, postpost) app.route(/delete/int:post_id, methods[POST]) def delete(post_id): post Post.query.get_or_404(post_id) db.session.delete(post) db.session.commit() return redirect(url_for(index))API服务from fastapi import FastAPI, HTTPException from pydantic import BaseModel from typing import List import uvicorn app FastAPI() class Item(BaseModel): id: int name: str price: float description: str None # 模拟数据库 items [ Item(id1, nameItem 1, price10.99, descriptionThis is item 1), Item(id2, nameItem 2, price19.99, descriptionThis is item 2) ] app.get(/api/items, response_modelList[Item]) def get_items(): return items app.post(/api/items, response_modelItem, status_code201) def create_item(item: Item): items.append(item) return item app.get(/api/items/{item_id}, response_modelItem) def get_item(item_id: int): for item in items: if item.id item_id: return item raise HTTPException(status_code404, detailItem not found) app.put(/api/items/{item_id}, response_modelItem) def update_item(item_id: int, item: Item): for i, existing_item in enumerate(items): if existing_item.id item_id: items[i] item return item raise HTTPException(status_code404, detailItem not found) app.delete(/api/items/{item_id}, status_code200) def delete_item(item_id: int): for i, item in enumerate(items): if item.id item_id: items.pop(i) return {message: Item deleted} raise HTTPException(status_code404, detailItem not found) if __name__ __main__: uvicorn.run(app, host127.0.0.1, port8000)最佳实践1. 代码组织使用模块化的结构将不同功能的代码分离到不同的文件和目录中遵循MVC或类似的架构模式使用蓝图Blueprint或类似机制组织路由2. 安全性使用HTTPS保护数据传输对用户输入进行验证和转义防止SQL注入和XSS攻击使用密码哈希存储用户密码实现适当的认证和授权机制定期更新依赖库修复安全漏洞3. 性能优化使用缓存减少数据库查询优化数据库查询使用索引启用Gzip压缩减少传输数据大小使用异步处理提高并发性能优化静态文件使用CDN分发4. 测试编写单元测试和集成测试使用测试框架如pytest实现持续集成和持续部署5. 文档为API编写文档使用Swagger或ReDoc为代码添加注释和文档字符串编写项目文档包括安装和使用说明常见问题和解决方案1. 数据库连接问题问题应用无法连接到数据库解决方案检查数据库服务是否正在运行检查连接字符串是否正确检查数据库用户是否有适当的权限检查防火墙是否阻止了连接2. 性能问题问题应用响应缓慢解决方案使用缓存减少数据库查询优化数据库查询启用Gzip压缩使用异步处理检查是否有内存泄漏3. 部署问题问题应用在生产环境中无法正常运行解决方案确保所有依赖库都已正确安装检查环境变量是否正确设置检查日志文件查找错误信息确保端口已正确配置4. 安全问题问题应用存在安全漏洞解决方案使用HTTPS对用户输入进行验证和转义使用密码哈希实现适当的认证和授权机制定期更新依赖库总结Python Web开发是一个广阔而充满活力的领域它提供了丰富的工具和框架使得构建现代Web应用变得更加简单和高效。通过掌握Python Web开发的核心概念和最佳实践我们可以构建各种类型的Web应用从简单的个人网站到复杂的企业级应用。在实际开发中Python Web开发常用于构建Web应用和网站开发API服务创建管理系统实现数据可视化构建电子商务平台通过不断学习和实践我们可以掌握Python Web开发的精髓构建更加可靠、高效、安全的Web应用。

相关文章:

Python Web开发实战:构建现代Web应用

Python Web开发实战:构建现代Web应用 Web开发的重要性 Web开发是现代软件开发中最活跃的领域之一,Python作为一种功能强大的编程语言,在Web开发中有着广泛的应用。从简单的个人网站到复杂的企业级应用,Python都能胜任。本文将介绍…...

Rust 智能指针实战指南:从原理到应用

Rust 智能指针实战指南:从原理到应用 引言 大家好,我是一名正在从Python转向Rust的后端开发者。最近在学习Rust的过程中,智能指针(Smart Pointers)这个概念给我留下了深刻的印象。作为从Python过来的开发者&#xff…...

企业云盘私有化部署后的数据迁移实战:如何实现PB级数据的平滑迁移与回滚方案

做企业云盘私有化部署的团队,数据迁移是绕不开的一道坎。说实话,这活儿比部署本身麻烦多了——部署出问题了可以重来,数据要是迁丢了或者损了,那才是真事故。 我最近两年经手了七八个PB级数据迁移项目,最大的一家是制造…...

STM32 Hard-Fault 硬件错误深度解析:从Cortex-M内核寄存器到具体代码错误的映射关系

STM32 Hard-Fault 硬件错误深度解析:从Cortex-M内核寄存器到具体代码错误的映射关系 在嵌入式开发中,Hard-Fault就像一位不速之客,总是在最意想不到的时刻突然造访。对于中高级嵌入式工程师而言,仅仅知道如何定位Hard-Fault是远远…...

告别玄学调试:用逻辑分析仪抓取STM32的PWM波形,验证无刷电机驱动时序

从波形诊断到精准调参:逻辑分析仪在无刷电机驱动开发中的实战应用 调试无刷电机驱动时,你是否经历过这样的困境:代码配置看似正确,但电机就是纹丝不动;或者电机虽然转动却伴随异常噪音和发热?传统"试错…...

Xenia Canary深度解析:如何用开源技术重现Xbox 360游戏体验?

Xenia Canary深度解析:如何用开源技术重现Xbox 360游戏体验? 【免费下载链接】xenia-canary Xbox 360 Emulator Research Project 项目地址: https://gitcode.com/gh_mirrors/xe/xenia-canary Xenia Canary作为Xbox 360开源模拟器的前沿分支&…...

2025届毕业生推荐的五大AI写作平台横评

Ai论文网站排名(开题报告、文献综述、降aigc率、降重综合对比) TOP1. 千笔AI TOP2. aipasspaper TOP3. 清北论文 TOP4. 豆包 TOP5. kimi TOP6. deepseek 现而今,人工智能技术已深度且广泛地融入到学术写作流程里面。以开题报告这个极为…...

3步极速配置:绝区零全自动游戏助手的完整使用指南

3步极速配置:绝区零全自动游戏助手的完整使用指南 【免费下载链接】ZenlessZoneZero-OneDragon 绝区零 一条龙 | 全自动 | 自动闪避 | 自动每日 | 自动空洞 | 支持手柄 项目地址: https://gitcode.com/gh_mirrors/ze/ZenlessZoneZero-OneDragon 你是否曾在深…...

从构思到部署:agent-skills如何实现完整的项目开发流程

从构思到部署:agent-skills如何实现完整的项目开发流程 【免费下载链接】agent-skills Production-grade engineering skills for AI coding agents. 项目地址: https://gitcode.com/GitHub_Trending/agentskill/agent-skills agent-skills是一套面向AI编码代…...

x402guard:轻量级进程守护工具的设计原理与实战部署指南

1. 项目概述:一个守护进程的诞生与使命在分布式系统和微服务架构大行其道的今天,服务的稳定性和高可用性成为了开发者头顶的“达摩克利斯之剑”。我们精心编写的应用进程,可能会因为内存泄漏、外部依赖中断、意外的死锁,甚至是操作…...

基于MCP协议的AI项目协作平台z3rno-mcp实战指南

1. 项目概述:一个AI驱动的开源协作平台最近在GitHub上看到一个挺有意思的项目,叫the-ai-project-co/z3rno-mcp。光看这个名字,可能有点摸不着头脑,但点进去研究了一下,发现它其实是一个围绕“AI项目协作”这个核心场景…...

FreedomGPT本地AI对话工具:基于Electron+React与llama.cpp的离线部署指南

1. 项目概述:一个能让你完全掌控的本地AI对话工具 如果你和我一样,对把数据交给云端大模型总有点不放心,或者受够了网络延迟和API调用限制,那么FreedomGPT这个项目绝对值得你花时间研究一下。简单来说,它是一个基于El…...

多模态提示注入攻击检测技术与实践

1. 多模态提示注入攻击检测概述在人工智能安全领域,提示注入攻击(Prompt Injection)已成为大语言模型(LLM)和视觉语言模型(VLM)面临的新型威胁。这种攻击通过精心构造的输入提示,诱导…...

Claude代码插件开发实战:从架构设计到安全实践

1. 项目概述:当Claude遇上代码插件如果你是一名开发者,或者经常与代码打交道,那么你肯定对Claude这个AI助手不陌生。它强大的代码理解和生成能力,让很多繁琐的编程任务变得轻松。但你是否想过,如果能让Claude直接“动手…...

基于微信小程序实现随堂测管理系统【内附项目源码+论文说明】

基于微信小程序实现随堂测管理系统演示摘要 移动互联网时代的到来,微信的普及,致使基于微信小程序的系统越来越多,因此,针对学校随堂测方面的需求,开发了本随堂测微信小程序。 本文重点阐述了随堂测微信小程序的开发…...

PlexTraktSync疑难问题排查:10个常见错误及解决方案

PlexTraktSync疑难问题排查:10个常见错误及解决方案 【免费下载链接】PlexTraktSync A python script that syncs the movies, shows and ratings between trakt and Plex (without needing a PlexPass or Trakt VIP subscription) 项目地址: https://gitcode.com…...

nvim-lsp-installer文件类型映射:如何根据文件类型自动选择服务器

nvim-lsp-installer文件类型映射:如何根据文件类型自动选择服务器 【免费下载链接】nvim-lsp-installer Further development has moved to https://github.com/williamboman/mason.nvim! 项目地址: https://gitcode.com/gh_mirrors/nv/nvim-lsp-installer n…...

对比直接使用原厂 API 观察通过 Taotoken 调用后的账单清晰度

对比直接使用原厂 API 观察通过 Taotoken 调用后的账单清晰度 当团队或个人开发者使用多个大模型服务时,成本追踪往往成为一个痛点。直接对接各家厂商的 API,意味着需要登录不同的控制台,面对格式各异的账单,手动汇总和分析支出。…...

别再只调库了!深入理解STM32 RTC时钟源选择(LSE/LSI/HSE)与低功耗设计要点

深入解析STM32 RTC时钟源选择与低功耗设计实战 在嵌入式系统开发中,实时时钟(RTC)模块的重要性常常被低估。很多开发者满足于在CubeMX中勾选几个配置选项就认为任务完成,却忽略了时钟源选择对系统稳定性、精度和功耗的关键影响。本文将带您深入STM32的RT…...

SketchUp STL插件:5分钟掌握3D打印模型转换的完整开源方案

SketchUp STL插件:5分钟掌握3D打印模型转换的完整开源方案 【免费下载链接】sketchup-stl A SketchUp Ruby Extension that adds STL (STereoLithography) file format import and export. 项目地址: https://gitcode.com/gh_mirrors/sk/sketchup-stl Sketch…...

告别米级误差:手把手教你用BLE Channel Sounding实现厘米级室内定位(附Nordic nRF SDK实战)

告别米级误差:手把手教你用BLE Channel Sounding实现厘米级室内定位(附Nordic nRF SDK实战) 在智能仓储和资产追踪领域,高精度定位一直是开发者面临的难题。传统UWB方案虽然精度高,但成本让许多项目望而却步&#xff1…...

MAA明日方舟助手:如何用智能自动化技术将每日游戏时间从2小时压缩到10分钟?

MAA明日方舟助手:如何用智能自动化技术将每日游戏时间从2小时压缩到10分钟? 【免费下载链接】MaaAssistantArknights 《明日方舟》小助手,全日常一键长草!| A one-click tool for the daily tasks of Arknights, supporting all c…...

020旋转图像

旋转图像 题目链接:https://leetcode.cn/problems/rotate-image/description/?envTypestudy-plan-v2&envIdtop-100-liked 我的解答: public void rotate(int[][] matrix) {int n matrix.length;int temp, pre;int row0, column, newRow0, newColum…...

3个隐藏技巧解锁KeymouseGo:让电脑替你打工的免费神器

3个隐藏技巧解锁KeymouseGo:让电脑替你打工的免费神器 【免费下载链接】KeymouseGo 类似按键精灵的鼠标键盘录制和自动化操作 模拟点击和键入 | automate mouse clicks and keyboard input 项目地址: https://gitcode.com/gh_mirrors/ke/KeymouseGo 你是否也…...

今天都做了什么?

2025年12月 2025.12.25 上午 用Gemini3提供的代码实现LeNet-5实现识别MNIST 跟着上手推了一下LeNet、AlexNet、VGG的网络结构以及计算了常规的输出结果维度 2025.12.25 下午 1、复现AlexNet,效果并不理想,因为使用的是数据生成器生产的图。 2、速读了…...

为Claude Code配置Taotoken密钥与聚合端点实现编程辅助

为Claude Code配置Taotoken密钥与聚合端点实现编程辅助 Claude Code 是一款广受开发者欢迎的编程辅助工具,它能够提供代码补全、解释和调试建议。通过将其后端服务接入 Taotoken 平台,开发者可以利用平台聚合的多种大模型能力,在熟悉的编辑环…...

SAP审计季救星:手把手教你用SE16分批次导出BKPF和BSEG序时账(附Excel分段技巧)

SAP审计季高效导出序时账:分批次处理BKPF与BSEG的实战指南 每到财务审计季,SAP系统中的序时账导出就成了让无数财务人员头疼的问题。数据量大、系统响应慢、导出失败率高,这些问题在审计截止日期临近时显得尤为突出。本文将分享一套经过实战验…...

如何用GIMP Resynthesizer实现智能图像修复:终极纹理合成指南

如何用GIMP Resynthesizer实现智能图像修复:终极纹理合成指南 【免费下载链接】resynthesizer Suite of gimp plugins for texture synthesis 项目地址: https://gitcode.com/gh_mirrors/re/resynthesizer 你是否曾想过,能否像魔术师一样从照片中…...

从LED调光到屏幕校准:手把手教你用色温CCT与xy坐标实现精准色彩控制

从LED调光到屏幕校准:手把手教你用色温CCT与xy坐标实现精准色彩控制 在智能照明和显示设备领域,精准的色彩控制已经成为提升用户体验的关键技术指标。无论是智能家居中的可调色温灯具,还是专业显示器、手机屏幕的色彩校准,都离不开…...

如何在5分钟内为通达信安装专业缠论分析插件:ChanlunX完全指南

如何在5分钟内为通达信安装专业缠论分析插件:ChanlunX完全指南 【免费下载链接】ChanlunX 缠中说禅炒股缠论可视化插件 项目地址: https://gitcode.com/gh_mirrors/ch/ChanlunX 你是否厌倦了手动绘制缠论笔段和中枢的繁琐过程?是否希望像专业分析…...