随笔分类 -  flask系列

摘要:示例 from sqlalchemy import create_engine, MetaData, and_, or_, TIMESTAMP Plugin.query.filter(and_(Plugin.job_name == job_name, or_(Plugin.group_id.is_( 阅读全文
posted @ 2019-06-11 23:11 脚本小娃子 阅读(928) 评论(0) 推荐(0)
摘要:转载:https://blog.csdn.net/Duke_Huan_of_Qi/article/details/76064225 阅读全文
posted @ 2018-11-22 23:45 脚本小娃子 阅读(217) 评论(0) 推荐(0)
摘要:请移步: http://blog.zengrong.net/post/2632.html https://stackoverflow.com/questions/9449101/how-to-stop-flask-from-initialising-twice-in-debug-mode/94767 阅读全文
posted @ 2018-10-17 09:37 脚本小娃子 阅读(463) 评论(0) 推荐(0)
摘要:全部转换为小写字符再进行比较 阅读全文
posted @ 2018-08-23 08:01 脚本小娃子 阅读(1083) 评论(0) 推荐(0)
摘要:1、flask控制上传文件的大小的方案是全局控制:http://docs.jinkan.org/docs/flask/patterns/fileuploads.html 2、flask还有个插件:https://pythonhosted.org/Flask-Uploads/#flaskext.upl 阅读全文
posted @ 2018-07-25 16:28 脚本小娃子 阅读(5485) 评论(1) 推荐(0)
摘要:参考: 1、https://zhuanlan.zhihu.com/p/24629177 2、https://github.com/shengulong/LearnPython/blob/master/python_restful_api.py 3、http://www.ruanyifeng.com/ 阅读全文
posted @ 2018-05-28 14:36 脚本小娃子 阅读(1243) 评论(0) 推荐(0)
摘要:目标:数据表的时间列在其他列内容更新的时候,自动更新时间列到更新的时间 方法:数据库表模型如下:server_default表示初始时间,onupdate表示更新的时间 参考: 1、https://blog.zengrong.net/post/2628.html 2、https://cloud.te 阅读全文
posted @ 2018-05-28 14:32 脚本小娃子 阅读(3787) 评论(1) 推荐(0)
摘要:Flask-Limiter provides rate limiting features to flask routes. It has support for a configurable backend for storage with current implementations for 阅读全文
posted @ 2018-05-10 14:03 脚本小娃子 阅读(8953) 评论(0) 推荐(0)
摘要:在Jinja模板中 可以简化为下面的写法,同时,保证返回值为空,而不是显示为“None” 阅读全文
posted @ 2018-04-02 14:50 脚本小娃子 阅读(2385) 评论(0) 推荐(0)
摘要:代码如下: 参考: http://blog.csdn.net/yannanxiu/article/details/53816567 阅读全文
posted @ 2018-03-23 11:33 脚本小娃子 阅读(361) 评论(0) 推荐(0)
摘要:SQLAlchemy打开SQL语句方法如下,echo=true将开启该功能: engine = create_engine("<db_rul>", echo=True) Flask-SQLAlchemy打开SQL方法如下: app.config["SQLALCHEMY_ECHO"] = True 阅读全文
posted @ 2018-01-30 16:43 脚本小娃子 阅读(6420) 评论(0) 推荐(0)
摘要:flask默认情况下是单进程的,所以每次只能处理一个请求; 当然可以多起几个进程或者线程,这样flask就可以处理多个请求; 认证后的用户,进行一次操作(一个GET操作、一次POST操作或者其他),会话信息会以Cookie:value的方式传送给flask应用,flask应用开启一个进程或者线程进行 阅读全文
posted @ 2018-01-24 16:28 脚本小娃子 阅读(1408) 评论(0) 推荐(0)
摘要:Flask-SQLAlchemy支持分页 https://www.jianshu.com/p/5e03cd202728 阅读全文
posted @ 2018-01-24 14:42 脚本小娃子 阅读(170) 评论(0) 推荐(0)
摘要:参考: 1、https://blog.igevin.info/wechats/wechat-flask-admin/ 2、http://flask-admin.readthedocs.io/en/latest/ 3、http://examples.flask-admin.org/ 4、http:// 阅读全文
posted @ 2018-01-12 09:57 脚本小娃子 阅读(485) 评论(0) 推荐(0)
摘要:1、sshd的hostkey设置: cat /etc/ssh/sshd_config 里面有rsa/dsa/ecdsa/ed25519 2、查看paramiko的keys选择顺序,如图所示 3、由以上两点可以得知:协商成功的算法将会是ssh-ed25519 4、使用下面的方法,可以自动添加缺失的ho 阅读全文
posted @ 2018-01-10 16:17 脚本小娃子 阅读(1598) 评论(0) 推荐(0)
摘要:apply one or more GROUP BY criterion to the query and return the newly resulting Query 2、官网解释: order_by(*criterion) apply one or more ORDER BY criteri 阅读全文
posted @ 2017-12-29 11:04 脚本小娃子 阅读(3586) 评论(2) 推荐(0)
摘要:pip search kafka可以搜索到很多kafka的python插件,选择一个大家用的比较多的 celery结合kafka使用 使用kafka扩展python logging集中式日志收集 redis做消息队列的话,存在丢消息的情况 kafka可以做到保证消息不丢失 参考: 1、http:// 阅读全文
posted @ 2017-12-28 10:03 脚本小娃子 阅读(1730) 评论(0) 推荐(0)
摘要:1、先看下文档 merge(instance, load=True) Copy the state of a given instance into a corresponding instance within this Session. Session.merge() examines the 阅读全文
posted @ 2017-12-27 21:26 脚本小娃子 阅读(9373) 评论(0) 推荐(0)
摘要:待学习: 1、https://www.cnblogs.com/jlj9520/p/6625535.html 2、http://python.jobbole.com/87112/ 3、 阅读全文
posted @ 2017-12-27 09:52 脚本小娃子 阅读(1243) 评论(0) 推荐(0)
摘要:1、使用自身服务器的多进程或者多线程,参考werkzeug的run_simple函数的入参。注意,进程和线程不能同时开启 2、使用gunicorn使用多进程,-w worker 进程数,类型于运行多个app.run()开发服务器 3、使用gevent异步 /usr/local/bin/gunicor 阅读全文
posted @ 2017-12-25 22:03 脚本小娃子 阅读(16888) 评论(0) 推荐(0)