我如何解决在AWS中上传的Flask应用程序中的502错误? [英] How can i fix 502 error in a flask application that i uploaded in AWS?

查看:149
本文介绍了我如何解决在AWS中上传的Flask应用程序中的502错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将我的flask应用程序上载到具有弹性beanstalk的AWS服务器时遇到问题.上传代码后,环境中会出现502错误的网关错误.

I'm having problems with uploading my flask app in an AWS server with elastic beanstalk. after I upload my code a 502 bad gateway error appears in the environment.

推荐答案

这是我挣扎了几个小时并使用Flask/Eb一年以上后的2美分.

Here are my 2 cents after grappling with this for a few hours and using Flask/Eb for over a year.

即使AWS教程对我来说也不起作用-我一直遇到此502错误.

Even the AWS tutorial did not work for me-- I kept getting this 502 error.

之所以遇到这个错误,是因为我在创建环境时选择了 Python 3.7 ,而我以前从未遇到过.此选择使Eb使用nginx作为默认代理服务器. (要查看此信息,请转到您的环境,选择配置",然后选择软件")

The reason why I ran into this error, whereas I had not before, was that I selected Python 3.7 when creating the environment. This selection causes Eb to use nginx as the default proxy server. (To see this, go to your environment, select Configuration, and then Software)

对我来说,最简单的解决方法是创建一个新环境并使用 Python 3.6 ,该工具的工作原理很吸引人.

The simple fix for me was to create a new environment and use Python 3.6, which worked like a charm.

希望有人找到了一个真正的解决方案,因为使用Python 3.7会很好,但是考虑到我对其代码进行了任何更改以使其正常工作,这甚至可能是一个AWS错误(只是将设置从Python 3.7更改为3.6) ).

Hopefully, someone finds a real solution because it would be nice to use Python 3.7, but this might even be an AWS bug considering I changed nothing about my code to get it to work (just the setup change from Python 3.7 to 3.6).

这篇关于我如何解决在AWS中上传的Flask应用程序中的502错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆