Errors with deploying website using Heroku/Flask Server

483 Views Asked by At

I am trying to deploy a website using Flask/SQLAlchemy to host my data base using waitress. I did try to follow this link but I don't think my file structure is the same Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)

Here is my file structure

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

When after trying to access my website I type this into my console heroku log --tail and this is what I get.

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

I am very new to trying to deploy a website and I honestly just followed the basic instruction that my professor gave to us here https://drive.google.com/file/d/1dltcKrigTvtJk3hHvl7I_y0KnlGuy3V9/view?usp=sharing

1

There are 1 best solutions below

5
On

The PermissionError indicates that you likely need to give executable permissions to a file. Try giving permissions to runner.py and/or server.py.

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

777 will give broad permissions for read/write/execute to owner/group/other. You may want something more specific like chmod 755 path/to/file.py. See the man page for chmod here.