摘要: FastCrud (简称fs) 是基于Vue3的面向配置的crud开发框架,快速开发crud功能,可作为低代码平台的基础框架。 安装并启动项目 参考http://fast-crud.docmirror.cn/guide/start/demo.html 我用的是fs-admin-element .en 阅读全文
posted @ 2023-12-24 00:44 紧肛胡撸娃 阅读(710) 评论(0) 推荐(0) 编辑
摘要: 如果有能复用的数据库,通过sqlalchemy可以直接对一个数据库数据进行增删改查的操作。 1. main.py初始化数据库连接,并自动生成表对象。 ...engine = create_engine("mysql+pymysql://root:@localhost:3306/xxx?charset 阅读全文
posted @ 2023-11-09 09:59 紧肛胡撸娃 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 自定义权限校验 重写添加用户接口增加groups字段 class DUserViewSet(CustomViewSet): ... def create(self, request, *args, **kwargs): serializer = self.get_serializer(data=re 阅读全文
posted @ 2023-11-02 10:23 紧肛胡撸娃 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 这一篇主要使用django框架实现用户注册和登录 编写接口并设置URL 根目录添加api文件夹,views.py添加register注册视图 @api_view(['POST']) def register(request: Request): if DUser.objects.filter(use 阅读全文
posted @ 2023-11-01 20:53 紧肛胡撸娃 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 首先需要创建一个django-rest-framework项目,如何创建可以参考https://www.django-rest-framework.org/tutorial/quickstart/,不再赘述。 创建完结构如图所示 settings.py配置mysql数据库 ... DATABASES 阅读全文
posted @ 2023-11-01 17:10 紧肛胡撸娃 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 首先需要分组表、用户表加入映射关系,然后分组表加入权限组字段·。 class InfoCrud(Base): __abstract__ = True # 作为父类使用,并且不在数据库生成此表 _create_time = Column('create_time', DateTime, default 阅读全文
posted @ 2023-11-01 10:19 紧肛胡撸娃 阅读(614) 评论(0) 推荐(0) 编辑
摘要: 这一篇主要实现用户注册和登录 编写接口并设置URL main.py添加注册表单参数和简单注册接口 from fastapi import FastAPI from pydantic import BaseModel import models from db import engine, Sessi 阅读全文
posted @ 2023-11-01 00:45 紧肛胡撸娃 阅读(1465) 评论(0) 推荐(0) 编辑
摘要: 除了falsk,SQLAlchemy也能很好的支持fastapi框架。 首先创建一个main.py from fastapi import FastAPI app = FastAPI() @app.post("/register") def register(): ... @app.post("/l 阅读全文
posted @ 2023-10-31 22:59 紧肛胡撸娃 阅读(493) 评论(0) 推荐(0) 编辑
摘要: fastapi框架原生docs的Responses中会有个默认的422Validation Error响应,但大多数实际开发应该不需要,如何去除呢? 我用的方法是用猴子补丁重写fastapi.openapi.util里的get_openapi_path方法,去掉加入默认422的那段代码即可,下面这些 阅读全文
posted @ 2023-07-14 13:23 紧肛胡撸娃 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 上一篇文章介绍了flask框架如何使用编写用户注册登录的功能 下一步编写查询用户列表接口,使用flask_restful的marshal方法来生成字段数据,加上之前编写的login_required from flask import Blueprint,jsonify from flask_res 阅读全文
posted @ 2022-10-16 20:24 紧肛胡撸娃 阅读(853) 评论(0) 推荐(1) 编辑