[Python] Flask shows TypeError: send_from_directory() missing 1 required positional argument:...

Discussão em 'Python' iniciado por Stack, Maio 21, 2025.

  1. Stack

    Stack Membro Participativo

    When I deploy my Flask app on Azure, the view raises TypeError: send_from_directory() missing 1 required positional argument: 'path'. This isn't happening when I run locally.

    from flask import send_from_directory

    @app.route('/download/<path:filename>', methods=['GET', 'POST'])
    def download(filename):
    uploads = os.path.join(app.root_path, app.config['UPLOAD_FOLDER'])
    return send_from_directory(directory=uploads, filename=filename)

    Continue reading...

Compartilhe esta Página