Gunicorn Flask应用程序未执行系统命令

问题描述 投票:0回答:1

这是我的代码`

 @app.route('/social_add/<us_id>/<us_phone>/<us_birth>/<us_gen>', methods=['POST', 'GET'])
    def social_add(us_id, us_phone, us_birth, us_gen):
        os.system("sudo chmod 777 /home/gor/tarber/static/user_image")
        os.system("mkdir /home/gor/tarber/static/user_image/" + us_id)
        os.system("sudo chmod 777 /home/gor/tarber/static/user_image/" + us_id)

这是错误`

gunicorn[119261]: sh: 1: sudo: not found
gunicorn[119261]: sh: 1: mkdir: not found
gunicorn[119261]: sh: 1: sudo: not found

我尝试过此程序`

subprocess.Popen("sudo chmod 777 /home/gor/tarber/static/user_image", shell=True)
subprocess.Popen("mkdir /home/gor/tarber/static/user_image/" + us_id, shell=True)
subprocess.Popen("sudo chmod 777 /home/gor/tarber/static/user_image/" + us_id, shell=True)

但是错误是相同的

python flask gunicorn python-venv
1个回答
0
投票
os.mkdir(filename, mode=0o777)
© www.soinside.com 2019 - 2024. All rights reserved.