-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
TigerZH
committed
Apr 9, 2022
1 parent
711a3d0
commit 2e77f32
Showing
3 changed files
with
150 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 西筹官网 | ||
|
||
##### 2022-04-02 | ||
|
||
- 修复“删除极致”文字错误 | ||
- 修复首页开发改成开放 | ||
- head添加首页标签 | ||
- 修改与底部间隔96px | ||
- 企业文化 蒙版透明度改为增加 | ||
- 企业文化保存上滑特效 | ||
- | ||
|
||
##### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,36 @@ | ||
# Python | ||
# 跨境电商 | ||
|
||
## Django rest framework | ||
## 2022-04-07 | ||
|
||
```shell | ||
# 当有增量的model修改或者删除的时候 先删除编译缓存文件 | ||
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete | ||
find . -path "*/migrations/*.pyc" -delete | ||
#重新生成 makemigrations | ||
python manage.py makemigrations | ||
python manage.py migrate | ||
# 后台部署 后台文件夹 /data/c18e/backend | ||
ps aux|grep uwsgi | ||
kill -9 PORT | ||
uwsgi -d --ini application/uwsgi.ini | ||
# 前端部署 | ||
yarn deploy | ||
``` | ||
- 商户首页修改为文档页面 | ||
- 修复bug | ||
|
||
## 2022-04-06 | ||
|
||
- 部署线上 | ||
- 修复抢红包弹窗不显示问题 | ||
- 修复网址长度字段限制导致无法上传的问题 | ||
|
||
## Python多进程和多线程哪个快? | ||
## 2022-04-05 | ||
|
||
## 进程(process) | ||
- 修改前端表单校验方案为react-hook-form | ||
- 添加商户礼物设置模块 | ||
- 添加客户端礼物模块逻辑 | ||
|
||
```python | ||
from multiprocessing import Process,Pool | ||
import time | ||
## 2022-04-04 | ||
|
||
def p_task(i): | ||
time.sleep(2) | ||
|
||
if __name__=='__main__': | ||
# 单个 | ||
p = Process(target=p_task, args=()) | ||
|
||
p.start() | ||
p.join() | ||
|
||
# 多个 | ||
pools = Pool(4) | ||
pools.apply_async(p_task, args=()) | ||
pools.apply_async(p_task, args=()) | ||
pools.close() | ||
pools.join() | ||
``` | ||
- 添加奖金模块 | ||
- 添加过期时间和用户网站字段 | ||
- 导入订单添加奖金金额字段 | ||
- 前端样式修改同步 | ||
|
||
## 线程(process) | ||
## 2022-04-03 | ||
|
||
```python | ||
import threading | ||
import time | ||
- 礼品卡话术模块 | ||
- 文件上传模块 | ||
- uwsgi部署改为高传输unix方式 | ||
- 增加域名模块 | ||
- 域名查询模块调试 | ||
- 前端使用tailwind支持 | ||
- 路由模块完善 | ||
|
||
def t_task(i): | ||
time.sleep(2) | ||
|
||
|
||
if __name__=='__main__': | ||
t1 = threading.Thread(target=t_task, args=(1,)) | ||
t2 = threading.Thread(target=t_task, args=(2,)) | ||
t1.start() | ||
t2.start() | ||
|
||
``` | ||
|
||
|
||
|
||
- 对CPU密集型代码(比如循环计算) - 多进程效率更高 | ||
- 对IO密集型代码(比如文件操作,网络爬虫) - 多线程效率更高 | ||
|
||
对于IO密集型操作,大部分消耗时间其实是等待时间,在等待时间中CPU是不需要工作的,那你在此期间提供双CPU资源也是利用不上的,相反对于CPU密集型代码,2个CPU干活肯定比一个CPU快很多。那么为什么多线程会对IO密集型代码有用呢?这时因为python碰到等待会释放GIL供新的线程使用,实现了线程间的切换。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters