Flask实现的功能:
- 用户信息显示
- 用户头像上传修改
目录结构:
用户个人信息显示:
1.views中user.py增添相关的视图函数:
@user.route('/profile/')
# 路由保护(需要登录才可访问)
@login_required
def profile():
return render_template('user/profile.html')
2.增加profile.html模板:
{% extends 'common/base.html' %}
{% block title %}个人信息{% endblock %}
{% block page_content %}
<h1>个人信息显示</h1>
<div class="form-group">
<label for="username">Password</label>
<input type="text" class="form-control" id="username" value="{

本文介绍了如何使用Flask框架实现用户个人信息显示和头像上传功能。详细步骤包括在views中添加视图函数,创建profile.html和icon.html模板,更新base.html,设置数据库配置,进行数据库迁移,以及编写辅助函数等。
最低0.47元/天 解锁文章
919

被折叠的 条评论
为什么被折叠?



