简体   繁体   English

404 in python flask EC2上的应用

[英]404 in python flask application on EC2

i'm kinda new to all this, so bare with me我对这一切有点陌生,对我来说如此裸露

I'm trying to deploy my flask app to EC2, and before getting to set a WSGI server, id like to try to connect to port 8080 the code can be found here: https://github.com/Klasyer/POBAP我正在尝试将我的 flask 应用程序部署到 EC2,在设置 WSGI 服务器之前,我想尝试连接到端口 8080,代码可以在这里找到: https://github.com/Klasyer/POBAP

I've set the flask app host to 0.0.0.0 and port to 8080 In EC2 i opened the inbound rule for 8080我已将 flask 应用程序主机设置为 0.0.0.0,将端口设置为 8080 在 EC2 中,我打开了 8080 的入站规则

When i try to open the app through the web ( http://18.223.32.186:8080/ ) i get a 404.当我尝试通过 web ( http://18.223.32.186:8080/ ) 打开应用程序时,我得到了 404。

What am i missing/doing wrong?我错过了什么/做错了什么? Thanks ahead for any help提前感谢您的帮助

Try attaching an elastic IP address to the instance that your running and once it is done you can access the flask app running in the instance.尝试将弹性 IP 地址附加到您正在运行的实例,完成后您可以访问实例中运行的 flask 应用程序。 But you should include the port number always while accessing it.但是您应该在访问它时始终包含端口号。

If you need the app to be accessed without the use of port number then in your flask app change the port number to 443 which is for HTTPS and 80 for HTTP. If you need HTTPS the process is somewhat different because you need to make a purchase but for HTTP it's free.如果您需要在不使用端口号的情况下访问应用程序,那么在您的 flask 应用程序中将端口号更改为 443,即 HTTPS 和 80 HTTP。如果您需要 HTTPS,则过程会有所不同,因为您需要购买但对于 HTTP 它是免费的。 So go on with HTTP by using the port number as 80所以 go 与 HTTP 通过使用端口号 80

app.run(host='0.0.0.0', port=80)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM