rinormaloku / k8s-mastery

Repository for the article "Learn Kubernetes in Under 3 Hours"
https://medium.com/p/114ff420e882/
893 stars 833 forks source link

Current Flask Version Throws Error #26

Open austincollinpena opened 4 years ago

austincollinpena commented 4 years ago

When running the application locally, this error is shown: AttributeError: 'Request' object has no attribute 'is_xhr' Upgrading flask to version 1.1.1 in your requirements.txt will fix the issue. It is likely related to this issue.

rinormaloku commented 4 years ago

Hi Austin,

I just tested this again, with python2 and 3 and it works fine. Do you know what could have been the root cause?

steverabino commented 4 years ago

Root cause can be found here: https://stackoverflow.com/a/60137731/6046659

The Werkzeug library (dependency from Flask) recently received a major update (0.16.1 --> 1.0.0) and it looks like Flask (<=0.12.4) does not restrict it.

You have 2 options:

  • Stick with your current version of Flask and restrict the Werkzeug version that is fetched explicitly in your application's setup.py or requirements.txt (werkzeug<1.0)

  • Upgrade to a recent version of Flask (>=1.0.0), it seem to be running fine with latest Werkzeug

gpowers01 commented 4 years ago

I ran into this issue tonight - bumped flask to Flask==1.1.1 in the sa-logic/sa/requirements.txt and the service worked.

dhruvdutt commented 4 years ago

In k8s-mastery/sa-logic/sa/requirements.txt file, change Flask version to 0.12.5 and do python3 -m pip install -r requirements.txt. Make sure you're using Python version 3. Check by doing python --version or python3 --version.