会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
张京墨
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
5
6
7
8
9
10
11
12
13
···
19
下一页
2020年4月3日
类的静态方法和类方法
摘要: 一:调用区别 class Demo(object): @staticmethod def static_method(): return "static_method" @classmethod def instance_method(self): return "instance_method"
阅读全文
posted @ 2020-04-03 15:55 张京墨
阅读(1583)
评论(0)
推荐(0)
2020年4月2日
flask自动捕获常见错误,针对性处理
摘要: 一:处理404错误 # flask自己抓取404错误,定义函数专门处理404错误 @app.errorhandler(404) def err_404(err): return "你要的页面飞到外太空了" 好处:统一管理同类型错误,并可以指定函数进行处理
阅读全文
posted @ 2020-04-02 22:40 张京墨
阅读(377)
评论(0)
推荐(0)
2020年3月31日
腾讯云服务器部署flask:一
摘要: app.py from flask import Flask,jsonify app = Flask(__name__) app.route("/index") def index(): print("进入函数") return "hello world" if __name__ == '__mai
阅读全文
posted @ 2020-03-31 00:03 张京墨
阅读(861)
评论(0)
推荐(0)
2020年3月29日
echo命令
摘要: 一:echo 将echo 后面的字符串输出 假如我们想看看 ifcofnig里面的内容 echo ifconfig:并没有显示我们想看到的效果 echo `ifconfig` 而不是 echo "ifconfig" 来显示config里面的内容 可是格式不对,看着别扭 echo "`ifconfig
阅读全文
posted @ 2020-03-29 16:33 张京墨
阅读(310)
评论(0)
推荐(0)
2020年3月28日
supervisor进程管理
摘要: 一:什么是 supervisor 超级用户,监管员的意思,Supervisor是一个进程管理工具,当进程中断的时候Supervisor能自动重新启动它。可以运行在各种类unix的机器上,supervisor就是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon(
阅读全文
posted @ 2020-03-28 17:46 张京墨
阅读(612)
评论(0)
推荐(0)
2020年3月25日
mysql的链接单例模式和线程池的优劣性
摘要: 单例模式代码 mysql_test.py from functools import wraps import pymysql def single(cls): """实现类的单例模式""" instance_dict = dict() @wraps(cls) def single_instance
阅读全文
posted @ 2020-03-25 17:53 张京墨
阅读(1122)
评论(0)
推荐(0)
2020年3月17日
Celery知识点
摘要: 一:celery 作用:celery能后执行异步操作,可以去执行耗时的函数,也可以用来做定时调度 例如:发短信,消息推送,音视频处理 普通函数 import time def add(x, y): print("进入函数") time.sleep(5) return x + y if __name_
阅读全文
posted @ 2020-03-17 17:09 张京墨
阅读(942)
评论(1)
推荐(0)
gevent
摘要: 一:gevent模块 import gevent def f(n): for i in range(n): print(gevent.getcurrent(), i) # 创建一个普通的greenlet对象,并进行切换 g1 = gevent.spawn(f, 5) g2 = gevent.spaw
阅读全文
posted @ 2020-03-17 15:15 张京墨
阅读(418)
评论(0)
推荐(0)
2020年3月10日
pymongo的数组操作
摘要: 数据样例 { "_id" : ObjectId("5e67343f00850012ec08ad3e"), "river" : [ "长江", "黄河", "淮河" ] } { "_id" : ObjectId("5e67343f00850012ec08ad3f"), "river" : [ "长江"
阅读全文
posted @ 2020-03-10 15:35 张京墨
阅读(2355)
评论(0)
推荐(0)
2020年2月29日
pymongo的聚合操作
摘要: pymongo的聚合操作 数据类型样式 /* 1 */ { "_id" : ObjectId("5e5a32fe2a89d7c2fc05b9fc"), "user_id" : "1", "amount" : 500, "status" : "A" } /* 2 */ { "_id" : Object
阅读全文
posted @ 2020-02-29 20:13 张京墨
阅读(6093)
评论(0)
推荐(0)
上一页
1
···
5
6
7
8
9
10
11
12
13
···
19
下一页
公告