mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
prepare for multi-node deployment
This commit is contained in:
13
utils/deploy.py
Normal file
13
utils/deploy.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import os, zipfile
|
||||
|
||||
|
||||
# 打包目录为zip文件(未压缩)
|
||||
def make_zip(source_dir, output_filename):
|
||||
zipf = zipfile.ZipFile(output_filename, 'w')
|
||||
pre_len = len(os.path.dirname(source_dir))
|
||||
for parent, dirnames, filenames in os.walk(source_dir):
|
||||
for filename in filenames:
|
||||
pathfile = os.path.join(parent, filename)
|
||||
arcname = pathfile[pre_len:].strip(os.path.sep) # 相对路径
|
||||
zipf.write(pathfile, arcname)
|
||||
zipf.close()
|
||||
Reference in New Issue
Block a user