python中flask操作 –vulsee.com
gitpython
pip install git python
获取项目:
git.Git(保存地址?).clone(git项目)
git.Repo.clone_from(git项目l,保存地址)
repo = Repo.clone_from('http://user:password@git项目','/home/vulsee.com/Project/',branch='分支名称')
flask实现文件下载:
@app.route('/download/<filename>', methods=["GET"])
def download(filename):
print (filename)
response_file = send_from_directory(directory = '下载文件目录',path='', filename=filename, as_attachment=True)
return response_file
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
python文件下载
zip = zipfile.ZipFile('./dowload', 'w', zipfile.ZIP_DEFLATED)
for item in os.listdir('./dowload/'):
zip.write(dir_name+os.sep+item)
zip.close()
print('目录压缩成功')