Issue
This is my first (proper) flask app and is essentially an extension of the Corey Schafer Flask YouTube tutorials.
Root folder:
Procfile
:
web: gunicorn --bind 0.0.0.0:$PORT run:bsstg
run.py
:
from bsstg import create_app
app = create_app()
if __name__ == '__main__':
app.run(debug=False)
bsstg folder:
Full error listing:
2021-08-21T14:57:45.224522+00:00 heroku[web.1]: State changed from starting to up
2021-08-21T14:57:47.689647+00:00 app[web.1]: /app/.heroku/python/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py:872: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.
2021-08-21T14:57:47.689676+00:00 app[web.1]: warnings.warn(FSADeprecationWarning(
2021-08-21T14:57:47.691540+00:00 app[web.1]: /app/.heroku/python/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py:872: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.
2021-08-21T14:57:47.691542+00:00 app[web.1]: warnings.warn(FSADeprecationWarning(
2021-08-21T14:57:48.011870+00:00 app[web.1]: Failed to find attribute 'bsstg' in 'run'.
2021-08-21T14:57:48.012140+00:00 app[web.1]: [2021-08-21 14:57:48 +0000] [8] [INFO] Worker exiting (pid: 8)
2021-08-21T14:57:48.012928+00:00 app[web.1]: Failed to find attribute 'bsstg' in 'run'.
2021-08-21T14:57:48.013176+00:00 app[web.1]: [2021-08-21 14:57:48 +0000] [7] [INFO] Worker exiting (pid: 7)
2021-08-21T14:57:48.130969+00:00 app[web.1]: [2021-08-21 14:57:48 +0000] [4] [INFO] Shutting down: Master
2021-08-21T14:57:48.131000+00:00 app[web.1]: [2021-08-21 14:57:48 +0000] [4] [INFO] Reason: App failed to load.
2021-08-21T14:57:48.194499+00:00 heroku[web.1]: Process exited with status 4
2021-08-21T14:57:48.281397+00:00 heroku[web.1]: State changed from up to crashed
2021-08-21T14:57:55.591575+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=bsstg.herokuapp.com request_id=3418126a-a6f6-4e31-93c9-0c688104f8e3 fwd="109.153.222.121" dyno= connect= service= status=503 bytes= protocol=https
2021-08-21T14:57:56.000370+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=bsstg.herokuapp.com request_id=c9360a07-edaa-4857-b5d6-4dcd445adbf7 fwd="109.153.222.121" dyno= connect= service= status=503 bytes= protocol=https
The error
Failed to find attribute 'bsstg' in 'run'"
(bsstg is the name of my app and folder where it exists) is what I have used as the title of the question but maybe this has been leading me around in circles. Two days on this now so any pointers greatly appreciated.
Solution
Your Procfile
is almost certainly wrong:
web: gunicorn --bind 0.0.0.0:$PORT run:bsstg
This runs Gunicorn as a web
process (one that accepts incoming HTTP and HTTPS requests). Gunicorn expects a WSGI app as an argument. You are passing in run:bsstg
, which tells Gunicorn to run whatever bsstg
is in the run
module.
That leads to the error you are seeing:
Failed to find attribute 'bsstg' in 'run'
There is no bsstg
in run.py
; the the WSGI app is called app
. Try changing it to
web: gunicorn --bind 0.0.0.0:$PORT run:app
Then commit and redeploy.
Answered By - Chris
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.