文章分类 -  Flask

flask九:cookie、session
摘要:一.会话技术 二.cookie示例 1.登录页面,templates/login.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Login</title> </head> <body> <form 阅读全文

posted @ 2020-06-19 17:38 myworldworld 阅读(167) 评论(0) 推荐(0)

flask八: request、response
摘要:一.Request 1.request属性 @first_blue.route("/get-request/") def get_request(): print(request.host) print(request.url) print(request.headers) print(reques 阅读全文

posted @ 2020-06-19 12:26 myworldworld 阅读(89) 评论(0) 推荐(0)

flask七:总结1
摘要: 阅读全文

posted @ 2020-06-19 11:01 myworldworld 阅读(50) 评论(0) 推荐(0)

flask六:四大内置对象
摘要:一.Request 1.request属性 @first_blue.route("/get-request/") def get_request(): print(request.host) print(request.url) print(request.headers) print(reques 阅读全文

posted @ 2020-06-19 10:53 myworldworld 阅读(144) 评论(0) 推荐(0)

flask五:配置
摘要:1.创建配置文件: # application/settings.py import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def get_db_uri(db_info): engine = 阅读全文

posted @ 2020-06-19 00:34 myworldworld 阅读(125) 评论(0) 推荐(0)

flask四:models
摘要:1.示例:flask_sqlalchemy ORM插件 在app属性中配置数据库,懒加载: # application/models.py from flask_sqlalchemy import SQLAlchemy models = SQLAlchemy() def init_model(app 阅读全文

posted @ 2020-06-18 23:12 myworldworld 阅读(224) 评论(0) 推荐(0)

插件2:flask-blueprint,插件3:flask-sqlalchemy,插件4:flask-migrate
摘要:插件2:flask-blueprint, 插件3:flask-sqlalchemy 插件4:flask-migrate 阅读全文

posted @ 2020-06-18 22:32 myworldworld 阅读(138) 评论(0) 推荐(0)

flask三: 模版
摘要:一.html模版示例: 新建html文件:application/templates/index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>首页</title> </head> <body> 阅读全文

posted @ 2020-06-18 22:21 myworldworld 阅读(112) 评论(0) 推荐(0)

flask二:路由
摘要:一.旧的路由方式 解决循环引用:views.py文件中传入app实例,def init_route(app) 使用懒加载的方法:使用函数调用的形式进行加载,创建app时加载路由(执行init_route(app)),把 他们包装在def create_app() 目录结构: 入口:manage.py 阅读全文

posted @ 2020-06-18 19:28 myworldworld 阅读(152) 评论(0) 推荐(0)

插件1: Flask-script
摘要:1. flask-scripts介绍 Flask的扩展都暴露在flask.ext命名空间下。 Flask-Script是一个让你的命令行支持自定义命令的工具,它为Flask程序添加一个命令行解释器。可以让我们的程序从命令行直接执行相应的程序。 Flask-Script插件为在Flask里编写额外的脚 阅读全文

posted @ 2020-06-18 18:30 myworldworld 阅读(294) 评论(0) 推荐(0)

Linux环境变量
摘要:linux环境变量: 系统级别 /etc/envirtonment,该方法是修改系统环境配置文件,如 # 如果/etc/bashrc文件不可编辑,需要修改为可编辑 chmod -v u+w /etc/environment vim /etc/profile # 在最后一行加上 export PATH 阅读全文

posted @ 2020-06-18 17:05 myworldworld 阅读(147) 评论(0) 推荐(0)

Flask一:介绍
摘要:一.介绍 Flask是一个python实现的web开发微框架。和Django一样,也是一个基于MVC设计模式的WEB框架。 官方文档: https://flask.palletsprojects.com/en/0.12.x/ 中文文档:http://docs.jinkan.org/docs/flas 阅读全文

posted @ 2020-06-18 16:38 myworldworld 阅读(200) 评论(0) 推荐(0)

导航