cs50/python-cs50

deprecation warning about werkzeug in new IDE

curiouskiwi opened this issue · 4 comments

in new IDE, some users getting a deprecation warning about werkzeug


ERROR:werkzeug:Error on request:

Traceback (most recent call last):

File "/opt/pyenv/versions/3.7.2/lib/python3.7/site-packages/werkzeug/serving.py", line 302, in run_wsgi

execute(self.server.app)

File "/opt/pyenv/versions/3.7.2/lib/python3.7/site-packages/werkzeug/serving.py", line 290, in execute

application_iter = app(environ, start_response)

File "/home/ubuntu/environment/project/application.py", line 24, in <module>

app = Flask(__name__)

File "/opt/pyenv/versions/3.7.2/lib/python3.7/site-packages/cs50/flask.py", line 32, in after

self.wsgi_app = ProxyFix(self.wsgi_app)

File "/opt/pyenv/versions/3.7.2/lib/python3.7/site-packages/werkzeug/contrib/fixers.py", line 141, in __init__

stacklevel=2,

DeprecationWarning: 'werkzeug.contrib.fixers.ProxyFix' has moved to 'werkzeug.middleware.proxy_fix.ProxyFix'. This import is deprecated as of version 0.15 and will be removed in 1.0.```

@kzidane as requested

To followup, this appears to happen if you have

from cs50 import SQL
db = SQL("sqlite:///name.db")

in two different files.

In the example I had, this was in application.py and in an imported helpers.py.

Removing it from helpers.py solved the problem.

@kzidane since ide.cs50.io now uses HTTPS for students' apps on cs50.xyz, I imagine we can remove https://github.com/cs50/python-cs50/blob/develop/src/cs50/flask.py#L23-L35 altogether now?

Fixed by 010b59e.