摘要: 这一篇主要使用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 紧肛胡撸娃 阅读(1466) 评论(0) 推荐(0) 编辑