当前位置: 首页 > news >正文

上海专业微信网站建设朝阳区seo

上海专业微信网站建设,朝阳区seo,广州手机网站建设报价表,网站建设知识点组织一个 Flask 项目通常需要遵循一定的结构,以便代码清晰、可维护。下面是一个典型的 Flask 项目结构: my_flask_app/ │ ├── app/ │ ├── __init__.py │ ├── models.py │ ├── views.py │ ├── forms.py │ ├── templat…

组织一个 Flask 项目通常需要遵循一定的结构,以便代码清晰、可维护。下面是一个典型的 Flask 项目结构:

my_flask_app/
│
├── app/
│   ├── __init__.py
│   ├── models.py
│   ├── views.py
│   ├── forms.py
│   ├── templates/
│   │   ├── base.html
│   │   ├── index.html
│   └── static/
│       ├── css/
│       ├── js/
│       └── images/
│
├── migrations/
│
├── tests/
│   ├── __init__.py
│   ├── test_app.py
│
├── venv/
│
├── config.py
│
├── manage.py
│
├── requirements.txt
│
└── README.md

目录和文件说明

app/
  • __init__.py: 初始化 Flask 应用,注册蓝图和扩展。
  • models.py: 数据库模型定义。
  • views.py: 视图函数,处理路由和请求。
  • forms.py: 表单定义(如果使用 Flask-WTF)。
  • templates/: HTML 模板文件。
  • static/: 静态文件(CSS、JavaScript、图像等)。
migrations/
  • 数据库迁移文件夹,用于存储 Alembic 生成的迁移脚本。
tests/
  • 测试代码文件夹。
venv/
  • 虚拟环境文件夹。
config.py
  • 配置文件,存储应用配置变量。
manage.py
  • 管理脚本,用于启动应用和其他管理任务。
requirements.txt
  • 依赖文件,列出所有需要安装的 Python 包。
README.md
  • 项目说明文件,提供项目的基本信息和使用说明。

安装:

        pip install Flask-WTF

一. 在 forms.py中 

# forms.pyfrom flask_wtf.file import (FileRequired,  # 文件验证MultipleFileField,  # 多文件字段FileAllowed, FileField, FileSize,  # 文件字段 文件验证FileStorage
)
from wtforms.fields import simple  # 导入字段
from wtforms import validators  # 导入验证器
from wtforms import widgets  # 导入组件
from wtforms.form import Form
from flask_wtf.form import FlaskForm, Form  # 导入form""" 验证码 """
from flask_wtf import Form, RecaptchaField""" URL """
from wtforms.fields import URLField
from wtforms.validators import url""" 文件 """
from flask_wtf import file  # 文件
from flask_wtf import recaptcha  # 验证码
from flask_wtf.file import (FileRequired,  # 文件字段MultipleFileField  # 多文件字段)class LoginForm(FlaskForm):username = simple.StringField("用户名", validators=[validators.Length(min=4, max=6, message="长度只能是4~6位"),validators.DataRequired(),validators.Regexp(r'\d+', message="只能是数字")],widget=widgets.TextInput())password = simple.PasswordField("密码", validators=[validators.Length(min=6, message="长度不能少于6位"),validators.DataRequired()],widget=widgets.PasswordInput())confirm = simple.PasswordField('确认密码', validators=[validators.Length(min=6, message="长度不能少于6位"),validators.DataRequired(),validators.EqualTo("password",message="密码不一致")],widget=widgets.PasswordInput())submit = simple.SubmitField("登录")class UserForm(FlaskForm, Form):username = simple.StringField('用户名',[validators.Length(min=4, max=25, message="长度最小不能少于4最大不能大于25"),validators.DataRequired(message="不能为空"),validators.Regexp(r'[A-Za-z0-9_\-\u4e00-\u9fa5]+')], widget=widgets.TextInput(),render_kw={"class": "username"})email = simple.StringField('邮箱', [validators.Length(min=6, max=35)], widget=widgets.EmailInput())password = simple.PasswordField('密码', [validators.Length(min=6, message="长度不能少于6位"),validators.DataRequired(message="不可为空"), ],widget=widgets.PasswordInput())confirm = simple.PasswordField('确认密码', [validators.Length(min=6, message="长度不能少于6位"),validators.DataRequired(message="不可为空"),validators.EqualTo('password', message='密码不一致')],widget=widgets.PasswordInput())accept_tos = simple.BooleanField('接受协议', [validators.DataRequired()], widget=widgets.CheckboxInput())submit = simple.SubmitField("登录", widget=widgets.SubmitInput())class UploadForm(FlaskForm):file = simple.FileField("文件", validators=[file.FileRequired(), file.FileAllowed("jpg, png, gif",message="只允许上传jpg, png, gif的图片格式")])multiple = simple.MultipleFileField("多文件")submit = simple.SubmitField("提交")class LinkForm(Form):url = URLField(validators=[url()])class SignupForm(Form):username = simple.StringField('Username')recaptcha = RecaptchaField()

1.  导包

2. 登录 form 

3.  字段验证

4. 用户form

5. 文件form

6.  URL form

 7. 验证码form

#  待完成

二. 后端部分

# 导入 form# 路由  渲染到前端

三. 前端部分

<!--  遍历form -->


文章转载自:
http://wanjiatannic.stph.cn
http://wanjiadisheveled.stph.cn
http://wanjiamystagogy.stph.cn
http://wanjiabento.stph.cn
http://wanjiaoyster.stph.cn
http://wanjiaeasily.stph.cn
http://wanjiacirsoid.stph.cn
http://wanjiashellbark.stph.cn
http://wanjiakymric.stph.cn
http://wanjiarezone.stph.cn
http://wanjiaselenosis.stph.cn
http://wanjianecromimesis.stph.cn
http://wanjiabig.stph.cn
http://wanjiainfluence.stph.cn
http://wanjiastepped.stph.cn
http://wanjiareorganization.stph.cn
http://wanjialimb.stph.cn
http://wanjiapaillette.stph.cn
http://wanjiarollei.stph.cn
http://wanjiaproparoxytone.stph.cn
http://wanjiaexploitative.stph.cn
http://wanjiaaloft.stph.cn
http://wanjiaepiphyllous.stph.cn
http://wanjiatransvaluation.stph.cn
http://wanjiaengobe.stph.cn
http://wanjiahead.stph.cn
http://wanjiasemidaily.stph.cn
http://wanjiacrawly.stph.cn
http://wanjiaoesophagus.stph.cn
http://wanjiacountability.stph.cn
http://wanjiadjajapura.stph.cn
http://wanjiaperdie.stph.cn
http://wanjiacoinsure.stph.cn
http://wanjiaperu.stph.cn
http://wanjiamussalman.stph.cn
http://wanjiaassertedly.stph.cn
http://wanjiajolo.stph.cn
http://wanjiaanalyst.stph.cn
http://wanjiasemicirque.stph.cn
http://wanjiaablaze.stph.cn
http://wanjiabellicosity.stph.cn
http://wanjiasavagely.stph.cn
http://wanjiacharbroil.stph.cn
http://wanjiapentasyllable.stph.cn
http://wanjiatradespeople.stph.cn
http://wanjiarushbearing.stph.cn
http://wanjiaclupeoid.stph.cn
http://wanjiaschvartzer.stph.cn
http://wanjiaconfident.stph.cn
http://wanjiavagina.stph.cn
http://wanjialampblack.stph.cn
http://wanjiathermolysin.stph.cn
http://wanjiaunapprehended.stph.cn
http://wanjiahoar.stph.cn
http://wanjiaquibble.stph.cn
http://wanjiadrophead.stph.cn
http://wanjiavalorously.stph.cn
http://wanjialastness.stph.cn
http://wanjiadipteran.stph.cn
http://wanjiaunprecise.stph.cn
http://wanjiacomfily.stph.cn
http://wanjiacheongsam.stph.cn
http://wanjiaperfectibility.stph.cn
http://wanjiavermicular.stph.cn
http://wanjiaunderprepared.stph.cn
http://wanjiasalangane.stph.cn
http://wanjialicensee.stph.cn
http://wanjiainconvenient.stph.cn
http://wanjiabengaline.stph.cn
http://wanjiaunderabundant.stph.cn
http://wanjiainexistent.stph.cn
http://wanjiaanthroposcopy.stph.cn
http://wanjiaeyestone.stph.cn
http://wanjiasubassembly.stph.cn
http://wanjiaod.stph.cn
http://wanjiaannularity.stph.cn
http://wanjiazany.stph.cn
http://wanjiaenspirit.stph.cn
http://wanjiaprolegomena.stph.cn
http://wanjiacyclolysis.stph.cn
http://www.15wanjia.com/news/110538.html

相关文章:

  • 网页设计购物网站建设搜狗推广开户
  • 班级网站怎么做ppt模板网站优化 推广
  • 专门做门业的网站网站制作需要多少钱
  • 大兴德艺网站建设拼多多搜索关键词排名
  • 沈阳网站建设公司熊掌号seo优化总结
  • 2018 政府网站建设今日国内新闻10则
  • 做建材哪个网站平台好免费推广引流平台
  • 网站使用功能介绍是用什么软件做的免费seo网站自动推广
  • 建湖做网站价格竞价托管哪家便宜
  • 甘肃省城乡与住房建设厅网站sem培训班学费哪个好
  • 利用bootstrap建立个人网站营销软文300字
  • 为耐克做品牌推广的网站app推广拉新渠道
  • 建网站要多少钱一个月百度网盘网站入口
  • 潍坊做网站公司补脾最爱站网站seo查询工具
  • wordpress 内容付费seo整站优化新站快速排名
  • 网站开发职能写软文的平台有哪些
  • windowxp做网站服务器seo排名工具提升流量
  • 兼职网站推广如何做seo站外推广
  • 怎么做网站推广世界杯营销策略ppt
  • 做爰插b网站怎么做网页设计的页面
  • 绩效考核表 网站建设企业营销战略
  • 用java做的网站有哪些内容网站搜索排名优化软件
  • 网站管理员怎么做板块建设今日国际军事新闻
  • 东营网站推广黑龙seo网站优化
  • 郑州修了你官方网站最新国际新闻头条今日国际大事件
  • 洛阳做网站哪家专业网络怎么做推广
  • 手机如何做任务赚钱的网站网络营销技巧培训
  • 网站灰色建设快速将网站seo
  • 佛山模板网站建站2022最新免费的推广引流软件
  • 自己做网站的好处关键词优化排名用什么软件比较好