python Cant start flask app using gunicorn on ubuntu server

ndasle7k  于 2023-06-28  发布在  Python
关注(0)|答案(1)|浏览(129)

大家好,所以我试图使 flask 应用程序运行在Ubuntu服务器上,我得到这个错误,每次我试图启动它。我到现在为止

× flaskapp.service - Flask App
     Loaded: loaded (/etc/systemd/system/flaskapp.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2023-06-27 11:35:53 UTC; 14min ago
    Process: 1689 ExecStart=/home/maxnet/.local/bin/gunicorn -w 4 -b 0.0.0.0:443 --certfile=/var/www/flaskapp/certs/cert.pem --keyfile=/var/www/flaskapp/certs/key.pem app:app (code=exited,>
   Main PID: 1689 (code=exited, status=1/FAILURE)
        CPU: 553ms

Jun 27 11:35:47 ubuntu-dev01 systemd[1]: Started Flask App.
Jun 27 11:35:48 ubuntu-dev01 gunicorn[1689]: [2023-06-27 11:35:48 +0000] [1689] [INFO] Starting gunicorn 20.1.0
Jun 27 11:35:48 ubuntu-dev01 gunicorn[1689]: [2023-06-27 11:35:48 +0000] [1689] [ERROR] Retrying in 1 second.
Jun 27 11:35:49 ubuntu-dev01 gunicorn[1689]: [2023-06-27 11:35:49 +0000] [1689] [ERROR] Retrying in 1 second.
Jun 27 11:35:50 ubuntu-dev01 gunicorn[1689]: [2023-06-27 11:35:50 +0000] [1689] [ERROR] Retrying in 1 second.
Jun 27 11:35:51 ubuntu-dev01 gunicorn[1689]: [2023-06-27 11:35:51 +0000] [1689] [ERROR] Retrying in 1 second.
Jun 27 11:35:52 ubuntu-dev01 gunicorn[1689]: [2023-06-27 11:35:52 +0000] [1689] [ERROR] Retrying in 1 second.
Jun 27 11:35:53 ubuntu-dev01 gunicorn[1689]: [2023-06-27 11:35:53 +0000] [1689] [ERROR] Can't connect to ('0.0.0.0', 443)
Jun 27 11:35:53 ubuntu-dev01 systemd[1]: flaskapp.service: Main process exited, code=exited, status=1/FAILURE
Jun 27 11:35:53 ubuntu-dev01 systemd[1]: flaskapp.service: Failed with result 'exit-code'.
~

我想这是一些许可的东西,但不确定。老实说,我不经常使用Ubuntu服务器。我还想提一下,我需要它在端口443上运行。我阅读到一些关于端口小于1024是特权的,但实际上不知道该怎么办。
(This这是我的第一篇文章,如果缺少了什么,请告诉我,我会尽量提供更多)

wj8zmpe1

wj8zmpe11#

好吧,所以基本上我所做的是窥探和发现,在 flask 应用程序中,我设置了port=443,我只是删除,它的工作。
……月后

相关问题