作者文章归档:陈海峰

[ 使用rsa加密pwd ]


前端使用js, 后端django

1.安装

pip install pycryptodomex

2. python后端内容

create_rsa_key.py

"""
create_rsa_key() - 创建RSA密钥
"""
from Cryptodome import Random

from Cryptodome.PublicKey import RSA
def create_rsa_key():
    """
    创建RSA密钥
    步骤说明:
    1、从 Crypto.Pub

< Read more >

[ 数友成-开发 ]


Production

Development 发展
Production 开发
Prod 产品
source 来源
assing to order 服从命令,排序
does 做
outstanding 未解决
actual 实际的
available 可获得的
process node 工艺节点
widgets 小器件
record 记录
Account 账户
complete 完成

error

1. 描述: django项目启动使用了environ.db()读取报错

DATABASES = {"default": env.db("DATABASE_URL&q

< Read more >

[ fastapi基础面试题 ]


FastAPI有以下几个优势:

高性能:FastAPI基于Starlette框架构建,利用了Python 3.7+中的异步特性,使得它能够处理高并发的请求。它使用异步请求处理框架uvicorn,性能比传统的基于线程或进程的服务器更高。

快速开发:FastAPI提供了一个简洁、声明性的语法,使得开发者能够快速地构建Web API。它支持自动进行请求参数验证和文档生成,减少了繁琐的手动操作,提高了开发效率。

强大的类型提示和自动文档生成:FastAPI利用Python的类型提示功能,能够在运行时自动验证请求和响应数据的类型,并生成详细的API文档。这使得团队协作变得更加容易,同时也方便了前后端的对

< Read more >

[ fastapi使用sqlalchemy2.0异步数据库 ]


fastapi使用sqlalchemy2.0异步数据库

pip install SQLAlchemy
pip install aiomysql
pip install pydantic-settings
pip install python-dotenv

配置文件config.py

from pydantic_settings import BaseSettings
from functools import lru_cache

class Settings(BaseSettings):
    app_name: str = "chf-app"
    databa

< Read more >

[ go-zero实战项目部署完整版 ]


go-zero微服务docker-compose部署完整版

演示git项目地址

一.前置条件

1. 安装go

2. git拉取代码

1. 创建文件夹go-weixin-obj
bin, pkg, src

2. 在src中执行
git clone xxx

3. 环境变量

export GOPATH='/xxx/go-weixin-obj/'

export CGO_ENABLED='0'

二.开始部署

1.docker-compose.yml

version: "3.0"
services:
  userrpc:
    hostna

< Read more >

[ go项目在linux-debian编译,在alpine运行 ]


1.在debian系统中执行

export CGO_ENABLED=0

2. 在重新执行build编译

go build -o xxxx

3. dockerfile - rpc服务

FROM docker.io/alpine

WORKDIR /code/app/

COPY . .

COPY Shanghai /usr/share/zoneinfo/Asia/Shanghai

EXPOSE 8081

CMD ["/code/app/MusicRpcServer"]

4. 运行docker

查看images镜像

docker run -d -p 8081

< Read more >