MythicalMisfits Tutorial Broken from Flask Update?



Previously posted this to python sub-forum, looks like this sub-forum might be more appropriate (so hopefully will get reply).

I'm new to AWS, trying to get through "Build Your First Web Application" tutorial (aka MythicalMisfits), and encountered the error:

File "/usr/local/lib/python2.7/dist-packages/werkzeug/", line 347, in getattr
return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'is_xhr' - [14/Mar/2020 22:26:07] "GET / HTTP/1.1" 500 -

Was on the step: Build Dynamic Website/Module 2B Deploy A Service With AWS Fargate/Step 1: Create a Flask Service/B: Test The Service Locally. AFAICT, I have executed each line of the tutorial correctly.

I found a Stack Overflow reference, which seemed to apply, that indicated there was a recent Flask update and that my 2 options are:

  1. Stick with your current version of Flask and restrict the Werkzeug version that is fetched explicitly in your application's or requirements.txt (werkzeug<1.0)
  2. Upgrade to a recent version of Flask (>=1.0.0), which is running fine with latest Werkzeug

I'm not sure how to do either of the above, or perhaps there is something else that went wrong?

Any assistance in handling the Flask update correctly, or otherwise getting the tutorial to work would be appreciated.

Thanks in advance!

asked 3 years ago20 views
2 Answers

Nvm, I misread the instructions. This error comes up before appending mysfits into the url, and doesn't seem to require any change.

answered 3 years ago

Actually, this really is a problem. The mysfits service works OK, but the healthcheck service ("/") does not, and gets the above exception. This causes the health check to fail and hence the service container to be stopped/restarted every few minutes, and the app doesn't work reliably.

Been scratching my head on this one for a couple of days, being totally new to AWS I thought it was an AWS thing not a python thing.

See for the underlying flask problem - one of the dependent modules (Werkzeug) was updated and removed a deprecated feature that flask 0.12 still requires.

Forcing flask to 0.12.5 seems to fix it for me:

diff --git a/module-2/app/service/requirements.txt b/module-2/app/service/requirements.txt
index 46ec477..8125a26 100644
--- a/module-2/app/service/requirements.txt
+++ b/module-2/app/service/requirements.txt
@@ -1,3 +1,3 @@

Remember to make the same change in subsequent modules of the tutorial.

Edited by: MilkmanGB on Mar 19, 2020 10:31 PM
Need to make the same change on all modules

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions