Heroku deploy error : gunicorn.errors.HaltServer: <HaltServer 'App failed to load.' 4>

Attempting to deploy dash app to heroku.

File structure:

app.py
index.py
- assets
- tabs
-- tab1
-- tab2

Procfile:


web: gunicorn index:app

index.py


if __name__ == '__main__':
    app.run_server(debug=True)

Traceback:


2020-06-07T16:16:36.982047+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-07T16:16:47.691752+00:00 heroku[web.1]: Starting process with command `gunicorn index:app`
2020-06-07T16:16:50.322056+00:00 app[web.1]: [2020-06-07 16:16:50 +0000] [4] [INFO] Starting gunicorn 19.9.0
2020-06-07T16:16:50.322664+00:00 app[web.1]: [2020-06-07 16:16:50 +0000] [4] [INFO] Listening at: http://0.0.0.0:6228 (4)
2020-06-07T16:16:50.322753+00:00 app[web.1]: [2020-06-07 16:16:50 +0000] [4] [INFO] Using worker: sync
2020-06-07T16:16:50.327017+00:00 app[web.1]: [2020-06-07 16:16:50 +0000] [10] [INFO] Booting worker with pid: 10
2020-06-07T16:16:50.407355+00:00 app[web.1]: [2020-06-07 16:16:50 +0000] [18] [INFO] Booting worker with pid: 18
2020-06-07T16:16:51.936751+00:00 heroku[web.1]: State changed from starting to up
2020-06-07T16:17:00.099116+00:00 app[web.1]: Application object must be callable.
2020-06-07T16:17:00.099362+00:00 app[web.1]: Application object must be callable.
2020-06-07T16:17:00.099665+00:00 app[web.1]: [2020-06-07 16:17:00 +0000] [18] [INFO] Worker exiting (pid: 18)
2020-06-07T16:17:00.099974+00:00 app[web.1]: [2020-06-07 16:17:00 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-06-07T16:17:00.374046+00:00 app[web.1]: Traceback (most recent call last):
2020-06-07T16:17:00.374101+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 210, in run
2020-06-07T16:17:00.374325+00:00 app[web.1]: self.sleep()
2020-06-07T16:17:00.374330+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 360, in sleep
2020-06-07T16:17:00.374565+00:00 app[web.1]: ready = select.select([self.PIPE[0]], [], [], 1.0)
2020-06-07T16:17:00.374566+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 245, in handle_chld
2020-06-07T16:17:00.374818+00:00 app[web.1]: self.reap_workers()
2020-06-07T16:17:00.374823+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 528, in reap_workers
2020-06-07T16:17:00.375116+00:00 app[web.1]: raise HaltServer(reason, self.APP_LOAD_ERROR)
2020-06-07T16:17:00.375117+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'App failed to load.' 4>
2020-06-07T16:17:00.375118+00:00 app[web.1]: 
2020-06-07T16:17:00.375118+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2020-06-07T16:17:00.375118+00:00 app[web.1]: 
2020-06-07T16:17:00.375119+00:00 app[web.1]: Traceback (most recent call last):
2020-06-07T16:17:00.375123+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2020-06-07T16:17:00.375234+00:00 app[web.1]: sys.exit(run())
2020-06-07T16:17:00.375235+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 61, in run
2020-06-07T16:17:00.375345+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2020-06-07T16:17:00.375346+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 223, in run
2020-06-07T16:17:00.375495+00:00 app[web.1]: super(Application, self).run()
2020-06-07T16:17:00.375496+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
2020-06-07T16:17:00.375623+00:00 app[web.1]: Arbiter(self).run()
2020-06-07T16:17:00.375624+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 232, in run
2020-06-07T16:17:00.375755+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2020-06-07T16:17:00.375755+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 345, in halt
2020-06-07T16:17:00.375949+00:00 app[web.1]: self.stop()
2020-06-07T16:17:00.375950+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 393, in stop
2020-06-07T16:17:00.376189+00:00 app[web.1]: time.sleep(0.1)
2020-06-07T16:17:00.376190+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 245, in handle_chld
2020-06-07T16:17:00.376464+00:00 app[web.1]: self.reap_workers()
2020-06-07T16:17:00.376468+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 528, in reap_workers
2020-06-07T16:17:00.376694+00:00 app[web.1]: raise HaltServer(reason, self.APP_LOAD_ERROR)
2020-06-07T16:17:00.376698+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'App failed to load.' 4>
2020-06-07T16:17:00.456438+00:00 heroku[web.1]: Process exited with status 1
2020-06-07T16:17:00.485090+00:00 heroku[web.1]: State changed from up to crashed
2020-06-07T16:17:02.000000+00:00 app[api]: Build succeeded
2020-06-07T16:17:24.841961+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=stroom-cre-platform.herokuapp.com request_id=52579f30-8e76-45c3-9294-943304f1dbfd fwd="103.90.69.217" dyno= connect= service= status=503 bytes= protocol=https
2020-06-07T16:17:26.561082+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=stroom-cre-platform.herokuapp.com request_id=fd1bd5a9-d123-4c24-8047-93694ef80f9d fwd="103.90.69.217" dyno= connect= service= status=503 bytes= protocol=https
2020-06-07T16:24:00.014416+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-07T16:24:13.066649+00:00 heroku[web.1]: Starting process with command `gunicorn index:app`
2020-06-07T16:24:15.928034+00:00 heroku[web.1]: State changed from starting to up
2020-06-07T16:24:15.529692+00:00 app[web.1]: [2020-06-07 16:24:15 +0000] [4] [INFO] Starting gunicorn 19.9.0
2020-06-07T16:24:15.530205+00:00 app[web.1]: [2020-06-07 16:24:15 +0000] [4] [INFO] Listening at: http://0.0.0.0:27209 (4)
2020-06-07T16:24:15.530296+00:00 app[web.1]: [2020-06-07 16:24:15 +0000] [4] [INFO] Using worker: sync
2020-06-07T16:24:15.533985+00:00 app[web.1]: [2020-06-07 16:24:15 +0000] [10] [INFO] Booting worker with pid: 10
2020-06-07T16:24:15.632805+00:00 app[web.1]: [2020-06-07 16:24:15 +0000] [18] [INFO] Booting worker with pid: 18
2020-06-07T16:24:24.128695+00:00 app[web.1]: Application object must be callable.
2020-06-07T16:24:24.129247+00:00 app[web.1]: [2020-06-07 16:24:24 +0000] [18] [INFO] Worker exiting (pid: 18)
2020-06-07T16:24:24.129692+00:00 app[web.1]: Application object must be callable.
2020-06-07T16:24:24.130252+00:00 app[web.1]: [2020-06-07 16:24:24 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-06-07T16:24:24.473942+00:00 app[web.1]: [2020-06-07 16:24:24 +0000] [4] [INFO] Shutting down: Master
2020-06-07T16:24:24.474050+00:00 app[web.1]: [2020-06-07 16:24:24 +0000] [4] [INFO] Reason: App failed to load.
2020-06-07T16:24:24.569716+00:00 heroku[web.1]: Process exited with status 4
2020-06-07T16:24:24.605118+00:00 heroku[web.1]: State changed from up to crashed
 

Hi @keval
I’m not too sure about uploading multipage app, but I think your procfile is supposed to end with ‘server’. Does it work if your procfile is?

web: gunicorn app:server

Hi @adamschroeder
I see. It didn’t work with app:server. To deploy locally, I run python index.py, so I figured I’d use web: gunicorn index:server which didn’t work either.