python – Script doesn’t work correctly with apache2 flask

today I uploaded my Flash script on apache2 and the lines of code related to the files aren’t working

(Sun Aug 29 17:10:53.751145 2021) (wsgi:error) (pid 9184:tid 140638074947328) (client :64477) File “/var/www/scrserver/scrserver.py”, line 36, in upload_image

(Sun Aug 29 17:10:53.751148 2021) (wsgi:error) (pid 9184:tid 140638074947328) (client :64477) with open(filepath, “w+”) as uncryptedfile:

(Sun Aug 29 17:10:53.751154 2021) (wsgi:error) (pid 9184:tid 140638074947328) (client :64477) FileNotFoundError: (Errno 2) No such file or directory: ‘static/uploads/C2kC8CHebc.jpg’

also the flask app works correctly at my computer

fragment of code:

token = f.decrypt(request.form.get(list(request.form)(3)).encode()).decode()
filename = secure_filename(f.decrypt(file.filename.encode()).decode())
filename = token+".jpg"
filepath = os.path.join(app.config('UPLOAD_FOLDER'))+filename
with open(filepath, "ab+") as uncryptedfile:
     uncryptedfile.write(f.decrypt(file.read()))```