MythicalMisfits Tutorial Broken from Flask Update?

0

Hi,

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/local.py", line 347, in getattr
return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'is_xhr'
172.17.0.1 - [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 setup.py 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!

parsoks
질문됨 4년 전233회 조회
2개 답변
0

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

parsoks
답변함 4년 전
0

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 https://github.com/pallets/flask/issues/3493 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 @@
-Flask==0.12.2
+Flask==0.12.5
 flask-cors==3.0.0
 boto3==1.7.16

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

답변함 4년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠