title: AttributeError: module 'werkzeug.utils' has no attribute 'send_from_directory'
body: <p>I have followed the Flask Uploading Files documentation at <a href="https://flask.palletsprojects.com/en/1.1.x/patterns/fileuploads/" rel="nofollow noreferrer">https://flask.palletsprojects.com/en/1.1.x/patterns/fileuploads/</a>, making a file called 'upload.py':</p>
  <pre><code>import os
  from flask import Flask, flash, request, redirect, url_for, send_from_directory
  from werkzeug.utils import secure_filename
  
  UPLOAD_FOLDER = '/opt/tabeteb/aiomed/dss/uploads/medical_imaging/cxr'
  ALLOWED_EXTENSIONS = {'jpg', 'jpeg', 'png', 'gif'}
  
  app = Flask(__name__)
  app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
  app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024
  
  def allowed_file(filename):
      return '.' in filename and \
             filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
  
  @app.route('/', methods=['GET', 'POST'])
  def upload_file():
      if request.method == 'POST':
          # check if the post request has the file part
          if 'file' not in request.files:
              flash('No file part')
              return redirect(request.url)
          file = request.files['file']
          # if user does not select file, browser also
          # submit an empty part without filename
          if file.filename == '':
              flash('No selected file')
              return redirect(request.url)
          if file and allowed_file(file.filename):
              filename = secure_filename(file.filename)
              file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
              return redirect(url_for('uploaded_file', filename=filename))
      return '''
      &lt;!doctype html&gt;
      &lt;title&gt;Upload new File&lt;/title&gt;
      &lt;h1&gt;Upload new File&lt;/h1&gt;
      &lt;form method=post enctype=multipart/form-data&gt;
        &lt;input type=file name=file&gt;
        &lt;input type=submit value=Upload&gt;
      &lt;/form&gt;
      '''
  
  @app.route('/uploads/&lt;filename&gt;')
  def uploaded_file(filename):
      return send_from_directory(app.config['UPLOAD_FOLDER'], filename)
  </code></pre>
  <p>Running the built-in server:</p>
  <pre><code>$ export FLASK_APP=upload.py
  $ flask run --host=0.0.0.0
  </code></pre>
  <p>is OK, but uploading a file returns an <strong>Internal server error</strong> on a such address (http://my_server_ip:5000/uploads/file_name.png) with an AttributeError regarding module <em>werkzeug.utils</em> with <em>send_from_directory</em> shown on server log:</p>
  <pre><code>[2020-11-25 10:13:43,414] ERROR in app: Exception on /uploads/file_name.png [GET]
  Traceback (most recent call last):
    File &quot;/opt/tabeteb/aiomed/dss/venv/lib/python3.6/site-packages/flask/app.py&quot;, line 2022, in wsgi_app
      response = self.full_dispatch_request()
    File &quot;/opt/tabeteb/aiomed/dss/venv/lib/python3.6/site-packages/flask/app.py&quot;, line 1537, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File &quot;/opt/tabeteb/aiomed/dss/venv/lib/python3.6/site-packages/flask/app.py&quot;, line 1535, in full_dispatch_request
      rv = self.dispatch_request()
    File &quot;/opt/tabeteb/aiomed/dss/venv/lib/python3.6/site-packages/flask/app.py&quot;, line 1521, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File &quot;/opt/tabeteb/aiomed/dss/upload.py&quot;, line 45, in uploaded_file
      return send_from_directory(app.config['UPLOAD_FOLDER'], filename)
    File &quot;/opt/tabeteb/aiomed/dss/venv/lib/python3.6/site-packages/flask/helpers.py&quot;, line 657, in send_from_directory
      return werkzeug.utils.send_from_directory(
  AttributeError: module 'werkzeug.utils' has no attribute 'send_from_directory'
  </code></pre>
  <p><strong>(EDITED)</strong>
  Using:</p>
  <ul>
  <li>Flask (2.0.0.dev0)</li>
  <li>Werkzeug (1.0.1)</li>
  <li>Ubuntu server 18.04.5</li>
  </ul>