使用Heroku / Flask Server部署网站时出错

时间:2018-11-18 23:10:31

标签: python node.js heroku flask waitress

我正在尝试使用Flask / SQLAlchemy部署网站来使用服务生来托管我的数据库。我确实尝试过此链接,但我不认为我的文件结构是相同的Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)

这是我的文件结构

Server
->BarBeerDrinker
 ->__pycache__
 ->static
 ->__init__.py
 ->configt.py
 ->database.py
->app.py
->Procfile
->requirements.txt

尝试访问我的网站后,将其输入控制台heroku log --tail,这就是我得到的。

2018-11-18T22:55:29.243807+00:00 heroku[web.1]: State changed from starting to crashed
2018-11-18T22:55:29.245456+00:00 heroku[web.1]: State changed from crashed to starting
2018-11-18T22:55:29.216028+00:00 heroku[web.1]: Process exited with status 1
2018-11-18T22:55:32.860988+00:00 heroku[web.1]: Starting process with command `waitress-serve --port=$8080 app:app`
2018-11-18T22:55:35.124713+00:00 app[web.1]: Traceback (most recent call last):
2018-11-18T22:55:35.124735+00:00 app[web.1]: File "/app/.heroku/python/bin/waitress-serve", line 11, in <module>
2018-11-18T22:55:35.124898+00:00 app[web.1]: sys.exit(run())
2018-11-18T22:55:35.124904+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/waitress/runner.py", line 274, in run
2018-11-18T22:55:35.125138+00:00 app[web.1]: _serve(app, **kw)
2018-11-18T22:55:35.125140+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/waitress/__init__.py", line 11, in serve
2018-11-18T22:55:35.125264+00:00 app[web.1]: server = _server(app, **kw)
2018-11-18T22:55:35.125270+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/waitress/server.py", line 85, in create_server
2018-11-18T22:55:35.125426+00:00 app[web.1]: sockinfo=sockinfo)
2018-11-18T22:55:35.125432+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/waitress/server.py", line 182, in __init__
2018-11-18T22:55:35.125614+00:00 app[web.1]: self.bind_server_socket()
2018-11-18T22:55:35.125616+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/waitress/server.py", line 294, in bind_server_socket
2018-11-18T22:55:35.125854+00:00 app[web.1]: self.bind(sockaddr)
2018-11-18T22:55:35.125857+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/asyncore.py", line 329, in bind
2018-11-18T22:55:35.126090+00:00 app[web.1]: return self.socket.bind(addr)
2018-11-18T22:55:35.126120+00:00 app[web.1]: PermissionError: [Errno 13] Permission denied
2018-11-18T22:55:35.308901+00:00 heroku[web.1]: State changed from starting to crashed
2018-11-18T22:55:35.259026+00:00 heroku[web.1]: Process exited with status 1
2018-11-18T22:55:53.439739+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=safe-sea-95736.herokuapp.com request_id=9afddc5b-75fe-4437-bd85-8ec0abf6dbb3 fwd="128.6.37.227" dyno= connect= service= status=503 bytes= protocol=https
2018-11-18T22:55:53.925888+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=safe-sea-95736.herokuapp.com request_id=29b560a2-e0d3-4814-afdd-51e767c375f9 fwd="128.6.37.227" dyno= connect= service= status=503 bytes= protocol=https
2018-11-18T22:59:39.925553+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=safe-sea-95736.herokuapp.com request_id=3633f1d0-3961-453d-b62f-8d9ba9790bfa fwd="128.6.37.227" dyno= connect= service= status=503 bytes= protocol=https
2018-11-18T22:59:40.329280+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=safe-sea-95736.herokuapp.com request_id=c1b91fc0-e2b9-41d6-9ad7-9c02033b16a2 fwd="128.6.37.227" dyno= connect= service= status=503 bytes= protocol=https

我对尝试部署网站非常陌生,老实说,我只是遵循教授在这里给我们的基本指导 https://drive.google.com/file/d/1dltcKrigTvtJk3hHvl7I_y0KnlGuy3V9/view?usp=sharing

1 个答案:

答案 0 :(得分:0)

PermissionError表示您可能需要授予文件可执行权限。尝试授予runner.py和/或server.py的权限。

chmod 777 /path/to/runner.py
chmod 777 /path/to/server.py

777将授予所有者/组/其他所有者广泛的读/写/执行权限。您可能需要更具体的内容,例如chmod 755 path/to/file.py。请参见手册页上的chmod here