摘要: admin/views.py中login添加代码:: online = request.form.get('online') if online: # 选择了记住我 session.permanent = True bp.permanent_session_lifetime = timedelta( 阅读全文
posted @ 2022-01-18 18:57 、阿红吖 阅读(254) 评论(0) 推荐(0) 编辑
摘要: admin/forms.py文件添加代码: from wtforms import Form, StringField from wtforms.validators import InputRequired, Length class LoginForm(Form): username = Str 阅读全文
posted @ 2022-01-18 18:41 、阿红吖 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 登录页渲染 项目文件中创建目录static,用于存放静态文件,我这里使用的是H-ui.admin_v3.1.3.1,需要的可以自己去下载,将解压后的文件夹中的lib、static、temp放入刚创建的static中。 templates中创建文件:admin/login.html <!DOCTYPE 阅读全文
posted @ 2022-01-18 18:26 、阿红吖 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 修改项目文件中apps/admin/models.py文件 from werkzeug.security import generate_password_hash,check_password_hash from exts import db class Users(db.Model): __ta 阅读全文
posted @ 2022-01-18 16:45 、阿红吖 阅读(369) 评论(0) 推荐(0) 编辑