Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'werkzeug.wsgi.middleware'; 'werkzeug.wsgi' is not a package #1663

Closed
connesy opened this issue Nov 15, 2019 · 3 comments
Milestone

Comments

@connesy
Copy link

@connesy connesy commented Nov 15, 2019

When using from werkzeug.wsgi import DispatcherMiddleware I get a DeprecationWarning:

DeprecationWarning: The import 'werkzeug.wsgi.DispatcherMiddleware' is deprecated and will be removed in Werkzeug 1.0. Use 'from werkzeug.wsgi.middleware.dispatcher import DispatcherMiddleware' instead.
  from werkzeug.wsgi import DispatcherMiddleware

But when I use that instead, I get a ModuleNotFoundError:

Traceback (most recent call last):
  File "services/server.py", line 8, in <module>
    from werkzeug.wsgi.middleware.dispatcher import DispatcherMiddleware
ModuleNotFoundError: No module named 'werkzeug.wsgi.middleware'; 'werkzeug.wsgi' is not a package

Werkzeug version 0.16.0.

@connesy

This comment has been minimized.

Copy link
Author

@connesy connesy commented Nov 15, 2019

It seems to work when I use

from werkzeug.middleware.dispatcher import DispatcherMiddleware

without the .wsgi., without a DeprecationWarning.

@Junnplus

This comment has been minimized.

Copy link
Contributor

@Junnplus Junnplus commented Nov 16, 2019

@davidism I try to make a pr for fix this issue, incorrect warning maybe puzzled

@dragonmaus

This comment was marked as off-topic.

Copy link

@dragonmaus dragonmaus commented Dec 24, 2019

The current documentation (found here) suggests that the proper import is from werkzeug.middleware.dispatcher import DispatcherMiddleware, but this does not work either. The only form that works is from werkzeug import DispatcherMiddleware:

>>> from werkzeug.wsgi.middleware.dispatcher import DispatcherMiddleware
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'werkzeug.wsgi.middleware'; 'werkzeug.wsgi' is not a package
>>> from werkzeug.middleware.dispatcher import DispatcherMiddleware
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'werkzeug.middleware'
>>> from werkzeug.dispatcher import DispatcherMiddleware
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'werkzeug.dispatcher'
>>> from werkzeug import DispatcherMiddleware
>>>
@davidism davidism added this to the 0.16.1 milestone Jan 4, 2020
@davidism davidism closed this Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.