I recently deployed my django site to heroku, but when I go to my site heroku site it tells me that there was an error and I should run heroku logs --tail. When I run it this is what I get:
2022-01-16T05:22:47.929147+00:00 heroku[web.1]: State changed from crashed to starting
2022-01-16T05:22:52.560445+00:00 heroku[web.1]: Starting process with command `gunicorn myproject.wsgi`
2022-01-16T05:22:54.004862+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [4] [INFO] Starting gunicorn 20.1.0
2022-01-16T05:22:54.005301+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [4] [INFO] Listening at: http://0.0.0.0:41179 (4)
2022-01-16T05:22:54.005342+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [4] [INFO] Using worker: sync
2022-01-16T05:22:54.013916+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [9] [INFO] Booting worker with pid: 9
2022-01-16T05:22:54.047924+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [9] [ERROR] Exception in worker process
2022-01-16T05:22:54.047941+00:00 app[web.1]: Traceback (most recent call last):
2022-01-16T05:22:54.047945+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-01-16T05:22:54.047948+00:00 app[web.1]: worker.init_process()
2022-01-16T05:22:54.047948+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2022-01-16T05:22:54.047949+00:00 app[web.1]: self.load_wsgi()
2022-01-16T05:22:54.047949+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-01-16T05:22:54.047949+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-01-16T05:22:54.047953+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-01-16T05:22:54.047953+00:00 app[web.1]: self.callable = self.load()
2022-01-16T05:22:54.047953+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-01-16T05:22:54.047953+00:00 app[web.1]: return self.load_wsgiapp()
2022-01-16T05:22:54.047954+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-01-16T05:22:54.047954+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-01-16T05:22:54.047954+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2022-01-16T05:22:54.047955+00:00 app[web.1]: mod = importlib.import_module(module)
2022-01-16T05:22:54.047955+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2022-01-16T05:22:54.047955+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-01-16T05:22:54.047955+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2022-01-16T05:22:54.047956+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2022-01-16T05:22:54.047956+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
2022-01-16T05:22:54.047956+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2022-01-16T05:22:54.047956+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2022-01-16T05:22:54.047957+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2022-01-16T05:22:54.047957+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2022-01-16T05:22:54.047957+00:00 app[web.1]: ModuleNotFoundError: No module named 'myproject'
2022-01-16T05:22:54.050692+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [9] [INFO] Worker exiting (pid: 9)
2022-01-16T05:22:54.053138+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [10] [INFO] Booting worker with pid: 10
2022-01-16T05:22:54.056946+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [10] [ERROR] Exception in worker process
2022-01-16T05:22:54.056947+00:00 app[web.1]: Traceback (most recent call last):
2022-01-16T05:22:54.056948+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-01-16T05:22:54.056948+00:00 app[web.1]: worker.init_process()
2022-01-16T05:22:54.056948+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2022-01-16T05:22:54.056949+00:00 app[web.1]: self.load_wsgi()
2022-01-16T05:22:54.056949+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-01-16T05:22:54.056949+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-01-16T05:22:54.056950+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-01-16T05:22:54.056950+00:00 app[web.1]: self.callable = self.load()
2022-01-16T05:22:54.056950+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-01-16T05:22:54.056951+00:00 app[web.1]: return self.load_wsgiapp()
2022-01-16T05:22:54.056951+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-01-16T05:22:54.056952+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-01-16T05:22:54.056952+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2022-01-16T05:22:54.056952+00:00 app[web.1]: mod = importlib.import_module(module)
2022-01-16T05:22:54.056952+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2022-01-16T05:22:54.056953+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-01-16T05:22:54.056953+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2022-01-16T05:22:54.056953+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2022-01-16T05:22:54.056954+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
2022-01-16T05:22:54.056954+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2022-01-16T05:22:54.056954+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2022-01-16T05:22:54.056954+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2022-01-16T05:22:54.056955+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2022-01-16T05:22:54.056955+00:00 app[web.1]: ModuleNotFoundError: No module named 'myproject'
2022-01-16T05:22:54.057129+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [10] [INFO] Worker exiting (pid: 10)
2022-01-16T05:22:54.099506+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [4] [WARNING] Worker with pid 9 was terminated due to signal 15
2022-01-16T05:22:54.199254+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [4] [INFO] Shutting down: Master
2022-01-16T05:22:54.199340+00:00 app[web.1]: [2022-01-16 05:22:54 +0000] [4] [INFO] Reason: Worker failed to boot.
2022-01-16T05:22:54.387799+00:00 heroku[web.1]: Process exited with status 3
2022-01-16T05:22:54.498114+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-16T05:22:57.000000+00:00 app[api]: Build succeeded
2022-01-16T05:23:01.227344+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=myproject.herokuapp.com request_id=49558b9a-5030-4ed9-bf0a-cc8642531c44 fwd="204.128.182.15" dyno= connect= service= status=503 bytes= protocol=https
2022-01-16T05:23:01.528171+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=myproject.herokuapp.com request_id=41626c63-e4e6-4e72-90e7-c0e36d3c928d fwd="204.128.182.15" dyno= connect= service= status=503 bytes= protocol=https
I can't find anything on how to fix this. Plus, it seems like this is a very generic code, so its hard to get accurate info on what to do. How can I get rid of this error?
Plus, I just figured how to fix ther error H14 I was getting.
Add to your settings.py file
DEBUG_PROPAGATE_EXCEPTIONS = True
Then set it to False after you Find the error
Fixed it - didn't capitalize the project name in the procfile.
Related
I recently learned to code and built a Flask application which im trying to deploy on Heroku (https://github.com/RoiHirsh/Final-Project.git). The code H10 im getting is generic and im not able to come up with clues as to how to debug this just by looking at the heroku logs. One thing that comes up everywhere is "Exception in worker process" which im not sure what that refers to.
I tried all the variations of the Procfile I saw here on stackoverflow, created the virtual environment, activated it, freezed requirements, installed gunicorn, created the runtime.txt etc.
From what I saw as solutions here on stackoverflow, I know i didnt actively setup a PORT on heroku and therefore overidden the default heroku one, there seems to be 1 dyno working correctly (so the Procfile should be fine), I tried pushing from git multiple times to see if its an issue of some requirements not being installed correctly, etc.
Here is the long Heroku logs, and some of the related files I created:
runtime.txt
python-3.10.6
requirements.txt
cachelib==0.9.0
certifi==2022.6.15
charset-normalizer==2.1.0
click==8.1.3
colorama==0.4.4
cs50==9.2.0
distlib==0.3.4
filelock==3.7.1
Flask==2.1.2
Flask-Session==0.4.0
greenlet==1.1.2
gunicorn==20.0.4
idna==3.3
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.1
platformdirs==2.5.2
requests==2.28.1
six==1.16.0
SQLAlchemy==1.4.37
sqlparse==0.4.2
termcolor==1.1.0
urllib3==1.26.10
virtualenv==20.15.1
Werkzeug==2.1.2
Procfile
web: gunicorn app:app
app.py
from flask import Flask, render_template, request
import inputs # importing all inputs from a separate python file - inputs.py
import sqlite3
app = Flask(__name__)
# some code
#app.route('/')
def home():
#some code
#app.route('/dashboard', methods=['POST','GET'])
def dashboard():
#some code
if __name__ == '__main__':
app.run(debug=True)
And the long Heroku logs --tail message:
» Warning: heroku update available from 7.53.0 to 7.63.4.
2022-09-18T09:50:58.371266+00:00 app[web.1]: [2022-09-18 09:50:58 +0000] [10] [INFO] Booting worker with pid: 10
2022-09-18T09:50:58.710094+00:00 app[web.1]: [2022-09-18 09:50:58 +0000] [10] [ERROR] Exception in worker process
2022-09-18T09:50:58.710114+00:00 app[web.1]: Traceback (most recent call last):
2022-09-18T09:50:58.710115+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2022-09-18T09:50:58.710115+00:00 app[web.1]: worker.init_process()
2022-09-18T09:50:58.710116+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/workers/base.py", line 119, in init_process
2022-09-18T09:50:58.710116+00:00 app[web.1]: self.load_wsgi()
2022-09-18T09:50:58.710117+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2022-09-18T09:50:58.710117+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-09-18T09:50:58.710118+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-09-18T09:50:58.710118+00:00 app[web.1]: self.callable = self.load()
2022-09-18T09:50:58.710118+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2022-09-18T09:50:58.710119+00:00 app[web.1]: return self.load_wsgiapp()
2022-09-18T09:50:58.710119+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2022-09-18T09:50:58.710119+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-09-18T09:50:58.710119+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/util.py", line 358, in import_app
2022-09-18T09:50:58.710120+00:00 app[web.1]: mod = importlib.import_module(module)
2022-09-18T09:50:58.710120+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-09-18T09:50:58.710122+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-09-18T09:50:58.710122+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2022-09-18T09:50:58.710122+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2022-09-18T09:50:58.710122+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked2022-09-18T09:50:58.710122+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2022-09-18T09:50:58.710123+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2022-09-18T09:50:58.710123+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2022-09-18T09:50:58.710123+00:00 app[web.1]: File "/app/app.py", line 2, in <module>
2022-09-18T09:50:58.710123+00:00 app[web.1]: import inputs # importing all inputs from a separate python file - inputs.py
2022-09-18T09:50:58.710123+00:00 app[web.1]: File "/app/inputs.py", line 13, in <module>
2022-09-18T09:50:58.710124+00:00 app[web.1]: cur.execute("SELECT * FROM daily_app_inputs WHERE dt = ?", temp) # fetching all the inputs for today
2022-09-18T09:50:58.710124+00:00 app[web.1]: sqlite3.OperationalError: no such table: daily_app_inputs
2022-09-18T09:50:58.710124+00:00 app[web.1]: [2022-09-18 09:50:58 +0000] [9] [ERROR] Exception in worker process
2022-09-18T09:50:58.710124+00:00 app[web.1]: Traceback (most recent call last):
2022-09-18T09:50:58.710124+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2022-09-18T09:50:58.710125+00:00 app[web.1]: worker.init_process()
2022-09-18T09:50:58.710125+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/workers/base.py", line 119, in init_process
2022-09-18T09:50:58.710125+00:00 app[web.1]: self.load_wsgi()
2022-09-18T09:50:58.710125+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2022-09-18T09:50:58.710126+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-09-18T09:50:58.710126+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-09-18T09:50:58.710126+00:00 app[web.1]: self.callable = self.load()
2022-09-18T09:50:58.710126+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2022-09-18T09:50:58.710126+00:00 app[web.1]: return self.load_wsgiapp()
2022-09-18T09:50:58.710133+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2022-09-18T09:50:58.710134+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-09-18T09:50:58.710134+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/util.py", line 358, in import_app
2022-09-18T09:50:58.710134+00:00 app[web.1]: mod = importlib.import_module(module)
2022-09-18T09:50:58.710134+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-09-18T09:50:58.710134+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-09-18T09:50:58.710134+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2022-09-18T09:50:58.710135+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2022-09-18T09:50:58.710135+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked2022-09-18T09:50:58.710135+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2022-09-18T09:50:58.710135+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2022-09-18T09:50:58.710135+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2022-09-18T09:50:58.710135+00:00 app[web.1]: File "/app/app.py", line 2, in <module>
2022-09-18T09:50:58.710135+00:00 app[web.1]: import inputs # importing all inputs from a separate python file - inputs.py
2022-09-18T09:50:58.710136+00:00 app[web.1]: File "/app/inputs.py", line 13, in <module>
2022-09-18T09:50:58.710136+00:00 app[web.1]: cur.execute("SELECT * FROM daily_app_inputs WHERE dt = ?", temp) # fetching all the inputs for today
2022-09-18T09:50:58.710136+00:00 app[web.1]: sqlite3.OperationalError: no such table: daily_app_inputs
2022-09-18T09:50:58.710196+00:00 app[web.1]: [2022-09-18 09:50:58 +0000] [9] [INFO] Worker exiting (pid: 9)
2022-09-18T09:50:58.710196+00:00 app[web.1]: [2022-09-18 09:50:58 +0000] [10] [INFO] Worker exiting (pid: 10)
2022-09-18T09:50:58.765954+00:00 app[web.1]: Traceback (most recent call last):
2022-09-18T09:50:58.765963+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 209, in run
2022-09-18T09:50:58.766171+00:00 app[web.1]: self.sleep()
2022-09-18T09:50:58.766179+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 357, in sleep
2022-09-18T09:50:58.766297+00:00 app[web.1]: ready = select.select([self.PIPE[0]], [], [], 1.0)
2022-09-18T09:50:58.766305+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2022-09-18T09:50:58.766407+00:00 app[web.1]: self.reap_workers()
2022-09-18T09:50:58.766415+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2022-09-18T09:50:58.766534+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2022-09-18T09:50:58.766586+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2022-09-18T09:50:58.766589+00:00 app[web.1]:
2022-09-18T09:50:58.766590+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2022-09-18T09:50:58.766590+00:00 app[web.1]:
2022-09-18T09:50:58.766597+00:00 app[web.1]: Traceback (most recent call last):
2022-09-18T09:50:58.766613+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2022-09-18T09:50:58.766683+00:00 app[web.1]: sys.exit(run())
2022-09-18T09:50:58.766692+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
2022-09-18T09:50:58.766760+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2022-09-18T09:50:58.766769+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/base.py", line 228, in run
2022-09-18T09:50:58.766854+00:00 app[web.1]: super().run()
2022-09-18T09:50:58.766862+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/base.py", line 72, in run
2022-09-18T09:50:58.766929+00:00 app[web.1]: Arbiter(self).run()
2022-09-18T09:50:58.766937+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 229, in run
2022-09-18T09:50:58.767017+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2022-09-18T09:50:58.767044+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 342, in halt
2022-09-18T09:50:58.767149+00:00 app[web.1]: self.stop()
2022-09-18T09:50:58.767162+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 393, in stop
2022-09-18T09:50:58.767262+00:00 app[web.1]: time.sleep(0.1)
2022-09-18T09:50:58.767270+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2022-09-18T09:50:58.767352+00:00 app[web.1]: self.reap_workers()
2022-09-18T09:50:58.767360+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2022-09-18T09:50:58.767470+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2022-09-18T09:50:58.767516+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2022-09-18T09:50:58.768416+00:00 heroku[web.1]: State changed from starting to up
2022-09-18T09:50:58.918308+00:00 heroku[web.1]: Process exited with status 1
2022-09-18T09:50:59.020525+00:00 heroku[web.1]: State changed from up to crashed
2022-09-18T09:51:00.000000+00:00 app[api]: Build succeeded
2022-09-18T09:51:13.561288+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=final-project-roi.herokuapp.com request_id=1155ae19-6f42-4e07-be8a-f3e68cebb0dd fwd="77.125.130.159" dyno= connect= service= status=503 bytes= protocol=https
2022-09-18T09:51:14.563562+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=final-project-roi.herokuapp.com request_id=9cb8ca83-bc6d-4b0a-bd66-6ac06c310ea0 fwd="77.125.130.159" dyno= connect= service= status=503 bytes= protocol=https
This is my project folder screenshot:
project folders
Thank you in advance for any thought I might take to try and debug this.
This question already has answers here:
Deploying 'Django for beginners' app to Heroku fails with ModuleNotFoundError: No module named '_tkinter'
(1 answer)
ModuleNotFoundError: No module named '_tkinter' Heroku
(4 answers)
"no module found: tkinter" after deploying in heroku
(1 answer)
Closed 8 months ago.
I get this error in my logs --tail
at=error code=H10 desc="App crashed" method=GET path="/" host=tsuyo-workout.herokuapp.com request_id=069bdbc7-cdb1-4d4e-8cc2-ec8dc55890f5 fwd="184.189.121.138" dyno= connect= service= status=503 bytes= protocol=https
At first I had my port set to 5000 as I was developing locally. I used this question to fix the h10 error. I still have the same error.
I fixed some other errors before this and they were:
Not having a Procfile. I added one.
Procfile:
web: gunicorn app:app
I fixed up my requirements.txt. I added gunicorn.
requirments.txt
click==8.0.3
Flask==2.0.2
itsdangerous==2.0.1
Jinja2==3.0.3
MarkupSafe==2.0.1
Werkzeug==2.0.3
gunicorn==20.0.4
I think the only relevant info in my app.py is this. Let me know if you need more:
app.py
app = Flask(__name__)
port = int(os.getenv('PORT'))
if __name__ == '__main__':
app.run(port=port)
I have a database in this app. Could it be the fact that I have a database?
Some more lines of errors per request.
2022-07-06T20:50:53.695436+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2022-07-06T20:50:53.695436+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-07-06T20:50:53.695437+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-07-06T20:50:53.695437+00:00 app[web.1]: self.callable = self.load()
2022-07-06T20:50:53.695437+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2022-07-06T20:50:53.695437+00:00 app[web.1]: return self.load_wsgiapp()
2022-07-06T20:50:53.695438+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2022-07-06T20:50:53.695438+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-07-06T20:50:53.695439+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app
2022-07-06T20:50:53.695439+00:00 app[web.1]: mod = importlib.import_module(module)
2022-07-06T20:50:53.695439+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
2022-07-06T20:50:53.695440+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-07-06T20:50:53.695440+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2022-07-06T20:50:53.695440+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2022-07-06T20:50:53.695440+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
2022-07-06T20:50:53.695441+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
2022-07-06T20:50:53.695441+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 843, in exec_module
2022-07-06T20:50:53.695441+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2022-07-06T20:50:53.695441+00:00 app[web.1]: File "/app/app.py", line 5, in <module>
2022-07-06T20:50:53.695442+00:00 app[web.1]: from helper import message, get_db_connection, default, login_required
2022-07-06T20:50:53.695442+00:00 app[web.1]: File "/app/helper.py", line 2, in <module>
2022-07-06T20:50:53.695442+00:00 app[web.1]: from turtle import clear
2022-07-06T20:50:53.695443+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/turtle.py", line 107, in <module>
2022-07-06T20:50:53.695443+00:00 app[web.1]: import tkinter as TK
2022-07-06T20:50:53.695443+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/tkinter/__init__.py", line 36, in <module>
2022-07-06T20:50:53.695444+00:00 app[web.1]: import _tkinter # If this fails your Python may not be configured for Tk
2022-07-06T20:50:53.695444+00:00 app[web.1]: ModuleNotFoundError: No module named '_tkinter'
2022-07-06T20:50:53.695559+00:00 app[web.1]: [2022-07-06 20:50:53 +0000] [11] [INFO] Worker exiting (pid: 11)
2022-07-06T20:50:53.696450+00:00 app[web.1]: [2022-07-06 20:50:53 +0000] [10] [ERROR] Exception in worker process
2022-07-06T20:50:53.696451+00:00 app[web.1]: Traceback (most recent call last):
2022-07-06T20:50:53.696451+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2022-07-06T20:50:53.696452+00:00 app[web.1]: worker.init_process()
2022-07-06T20:50:53.696452+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py", line 119, in init_process
2022-07-06T20:50:53.696452+00:00 app[web.1]: self.load_wsgi()
2022-07-06T20:50:53.696453+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2022-07-06T20:50:53.696453+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-07-06T20:50:53.696454+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-07-06T20:50:53.696454+00:00 app[web.1]: self.callable = self.load()
2022-07-06T20:50:53.696454+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2022-07-06T20:50:53.696454+00:00 app[web.1]: return self.load_wsgiapp()
2022-07-06T20:50:53.696455+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2022-07-06T20:50:53.696455+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-07-06T20:50:53.696455+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app
2022-07-06T20:50:53.696455+00:00 app[web.1]: mod = importlib.import_module(module)
2022-07-06T20:50:53.696456+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
2022-07-06T20:50:53.696456+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-07-06T20:50:53.696457+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2022-07-06T20:50:53.696457+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2022-07-06T20:50:53.696457+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
2022-07-06T20:50:53.696458+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
2022-07-06T20:50:53.696458+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 843, in exec_module
2022-07-06T20:50:53.696458+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2022-07-06T20:50:53.696459+00:00 app[web.1]: File "/app/app.py", line 5, in <module>
2022-07-06T20:50:53.696459+00:00 app[web.1]: from helper import message, get_db_connection, default, login_required
2022-07-06T20:50:53.696459+00:00 app[web.1]: File "/app/helper.py", line 2, in <module>
2022-07-06T20:50:53.696460+00:00 app[web.1]: from turtle import clear
2022-07-06T20:50:53.696462+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/turtle.py", line 107, in <module>
2022-07-06T20:50:53.696462+00:00 app[web.1]: import tkinter as TK
2022-07-06T20:50:53.696463+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/tkinter/__init__.py", line 36, in <module>
2022-07-06T20:50:53.696463+00:00 app[web.1]: import _tkinter # If this fails your Python may not be configured for Tk
2022-07-06T20:50:53.696463+00:00 app[web.1]: ModuleNotFoundError: No module named '_tkinter'
2022-07-06T20:50:53.696580+00:00 app[web.1]: [2022-07-06 20:50:53 +0000] [10] [INFO] Worker exiting (pid: 10)
2022-07-06T20:50:53.745546+00:00 app[web.1]: Traceback (most recent call last):
2022-07-06T20:50:53.745553+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 209, in run
2022-07-06T20:50:53.745765+00:00 app[web.1]: self.sleep()
2022-07-06T20:50:53.745775+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 357, in sleep
2022-07-06T20:50:53.745917+00:00 app[web.1]: ready = select.select([self.PIPE[0]], [], [], 1.0)
2022-07-06T20:50:53.745927+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2022-07-06T20:50:53.746025+00:00 app[web.1]: self.reap_workers()
2022-07-06T20:50:53.746033+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2022-07-06T20:50:53.746179+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2022-07-06T20:50:53.746222+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2022-07-06T20:50:53.746223+00:00 app[web.1]:
2022-07-06T20:50:53.746223+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2022-07-06T20:50:53.746223+00:00 app[web.1]:
2022-07-06T20:50:53.746230+00:00 app[web.1]: Traceback (most recent call last):
2022-07-06T20:50:53.746232+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2022-07-06T20:50:53.746304+00:00 app[web.1]: sys.exit(run())
2022-07-06T20:50:53.746306+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
2022-07-06T20:50:53.746383+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2022-07-06T20:50:53.746398+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py", line 228, in run
2022-07-06T20:50:53.746488+00:00 app[web.1]: super().run()
2022-07-06T20:50:53.746489+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py", line 72, in run
2022-07-06T20:50:53.746561+00:00 app[web.1]: Arbiter(self).run()
2022-07-06T20:50:53.746563+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 229, in run
2022-07-06T20:50:53.746654+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2022-07-06T20:50:53.746656+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 342, in halt
2022-07-06T20:50:53.746772+00:00 app[web.1]: self.stop()
2022-07-06T20:50:53.746773+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 388, in stop
2022-07-06T20:50:53.746893+00:00 app[web.1]: limit = time.time() + self.cfg.graceful_timeout
2022-07-06T20:50:53.746894+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/config.py", line 57, in __getattr__
2022-07-06T20:50:53.746969+00:00 app[web.1]: return self.settings[name].get()
2022-07-06T20:50:53.746971+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2022-07-06T20:50:53.747058+00:00 app[web.1]: self.reap_workers()
2022-07-06T20:50:53.747068+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2022-07-06T20:50:53.747213+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2022-07-06T20:50:53.747235+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2022-07-06T20:50:53.882989+00:00 heroku[web.1]: Process exited with status 1
2022-07-06T20:50:53.927947+00:00 heroku[web.1]: State changed from up to crashed
2022-07-06T21:18:19.470130+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=tsuyo-workout.herokuapp.com request_id=767ea937-4ad8-46f4-ad68-a8fa68f8c15b fwd="184.189.121.138" dyno= connect= service= status=503 bytes= protocol=https
I am trying to deploy my Django app to Heroku. I am following all the steps mentioned on Heroku dev center https://devcenter.heroku.com/articles/django-app-configuration. The app deploys successfully but when I run heroku open or manually visit the link it shows
Application error
An error occurred in the application and your page could not be
served. If you are the application owner, check your logs for details.
You can do this from the Heroku CLI with the command heroku logs
--tail
My Logs:
2021-07-13T18:26:37.515968+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-07-13T18:26:37.515969+00:00 app[web.1]: self.callable = self.load()
2021-07-13T18:26:37.515969+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2021-07-13T18:26:37.515970+00:00 app[web.1]: return self.load_wsgiapp()
2021-07-13T18:26:37.515970+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2021-07-13T18:26:37.515970+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-07-13T18:26:37.515970+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2021-07-13T18:26:37.515971+00:00 app[web.1]: mod = importlib.import_module(module)
2021-07-13T18:26:37.515971+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2021-07-13T18:26:37.515972+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-07-13T18:26:37.515972+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-07-13T18:26:37.515973+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-07-13T18:26:37.515973+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
2021-07-13T18:26:37.515973+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2021-07-13T18:26:37.515974+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-07-13T18:26:37.515974+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-07-13T18:26:37.515974+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2021-07-13T18:26:37.515975+00:00 app[web.1]: ModuleNotFoundError: No module named 'myproject'
2021-07-13T18:26:37.516146+00:00 app[web.1]: [2021-07-13 18:26:37 +0000] [7] [INFO] Worker exiting (pid: 7)
2021-07-13T18:26:37.520489+00:00 app[web.1]: [2021-07-13 18:26:37 +0000] [8] [INFO] Booting worker with pid: 8
2021-07-13T18:26:37.527381+00:00 app[web.1]: [2021-07-13 18:26:37 +0000] [8] [ERROR] Exception in worker process
2021-07-13T18:26:37.527382+00:00 app[web.1]: Traceback (most recent call last):
2021-07-13T18:26:37.527383+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2021-07-13T18:26:37.527383+00:00 app[web.1]: worker.init_process()
2021-07-13T18:26:37.527384+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2021-07-13T18:26:37.527384+00:00 app[web.1]: self.load_wsgi()
2021-07-13T18:26:37.527385+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2021-07-13T18:26:37.527387+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-07-13T18:26:37.527388+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-07-13T18:26:37.527388+00:00 app[web.1]: self.callable = self.load()
2021-07-13T18:26:37.527389+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2021-07-13T18:26:37.527389+00:00 app[web.1]: return self.load_wsgiapp()
2021-07-13T18:26:37.527389+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2021-07-13T18:26:37.527390+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-07-13T18:26:37.527390+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2021-07-13T18:26:37.527391+00:00 app[web.1]: mod = importlib.import_module(module)
2021-07-13T18:26:37.527391+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2021-07-13T18:26:37.527392+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-07-13T18:26:37.527392+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-07-13T18:26:37.527392+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-07-13T18:26:37.527393+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
2021-07-13T18:26:37.527393+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2021-07-13T18:26:37.527394+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-07-13T18:26:37.527394+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-07-13T18:26:37.527394+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2021-07-13T18:26:37.527395+00:00 app[web.1]: ModuleNotFoundError: No module named 'myproject'
2021-07-13T18:26:37.527519+00:00 app[web.1]: [2021-07-13 18:26:37 +0000] [8] [INFO] Worker exiting (pid: 8)
2021-07-13T18:26:37.575136+00:00 app[web.1]: [2021-07-13 18:26:37 +0000] [4] [WARNING] Worker with pid 7 was terminated due to signal 15
2021-07-13T18:26:37.677918+00:00 app[web.1]: [2021-07-13 18:26:37 +0000] [4] [INFO] Shutting down: Master
2021-07-13T18:26:37.678111+00:00 app[web.1]: [2021-07-13 18:26:37 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-07-13T18:26:37.781026+00:00 heroku[web.1]: Process exited with status 3
2021-07-13T18:26:37.959596+00:00 heroku[web.1]: State changed from starting to crashed
2021-07-13T18:26:37.964944+00:00 heroku[web.1]: State changed from crashed to starting
2021-07-13T18:26:53.000000+00:00 app[api]: Build succeeded
2021-07-13T18:26:55.063317+00:00 heroku[web.1]: Starting process with command `gunicorn myproject.wsgi`
2021-07-13T18:26:59.003109+00:00 app[web.1]: [2021-07-13 18:26:59 +0000] [4] [INFO] Starting gunicorn 20.1.0
2021-07-13T18:26:59.003975+00:00 app[web.1]: [2021-07-13 18:26:59 +0000] [4] [INFO] Listening at: http://0.0.0.0:50049 (4)
2021-07-13T18:26:59.004155+00:00 app[web.1]: [2021-07-13 18:26:59 +0000] [4] [INFO] Using worker: sync
2021-07-13T18:26:59.013689+00:00 app[web.1]: [2021-07-13 18:26:59 +0000] [7] [INFO] Booting worker with pid: 7
2021-07-13T18:26:59.020640+00:00 app[web.1]: [2021-07-13 18:26:59 +0000] [7] [ERROR] Exception in worker process
2021-07-13T18:26:59.020665+00:00 app[web.1]: Traceback (most recent call last):
2021-07-13T18:26:59.020672+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2021-07-13T18:26:59.020677+00:00 app[web.1]: worker.init_process()
2021-07-13T18:26:59.020678+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2021-07-13T18:26:59.020678+00:00 app[web.1]: self.load_wsgi()
2021-07-13T18:26:59.020679+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2021-07-13T18:26:59.020679+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-07-13T18:26:59.020684+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-07-13T18:26:59.020685+00:00 app[web.1]: self.callable = self.load()
2021-07-13T18:26:59.020685+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2021-07-13T18:26:59.020686+00:00 app[web.1]: return self.load_wsgiapp()
2021-07-13T18:26:59.020686+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2021-07-13T18:26:59.020686+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-07-13T18:26:59.020687+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2021-07-13T18:26:59.020687+00:00 app[web.1]: mod = importlib.import_module(module)
2021-07-13T18:26:59.020687+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2021-07-13T18:26:59.020688+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-07-13T18:26:59.020688+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-07-13T18:26:59.020689+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-07-13T18:26:59.020689+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
2021-07-13T18:26:59.020690+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2021-07-13T18:26:59.020690+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-07-13T18:26:59.020691+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-07-13T18:26:59.020691+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2021-07-13T18:26:59.020692+00:00 app[web.1]: ModuleNotFoundError: No module named 'myproject'
2021-07-13T18:26:59.020997+00:00 app[web.1]: [2021-07-13 18:26:59 +0000] [7] [INFO] Worker exiting (pid: 7)
2021-07-13T18:26:59.089336+00:00 app[web.1]: [2021-07-13 18:26:59 +0000] [4] [INFO] Shutting down: Master
2021-07-13T18:26:59.089511+00:00 app[web.1]: [2021-07-13 18:26:59 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-07-13T18:26:59.214561+00:00 heroku[web.1]: Process exited with status 3
2021-07-13T18:26:59.325816+00:00 heroku[web.1]: State changed from starting to crashed
2021-07-13T18:27:01.234730+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=heyady.herokuapp.com request_id=a7547546-fb0f-4a00-83ea-619e7128aef1 fwd="169.149.36.45" dyno= connect= service= status=503 bytes= protocol=https
2021-07-13T18:27:01.959325+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=heyady.herokuapp.com request_id=8d35e215-091f-432f-abf1-1a3dae52be5b fwd="169.149.36.45" dyno= connect= service= status=503 bytes= protocol=https
2021-07-13T18:28:08.924235+00:00 app[api]: Starting process with command `python manage.py migrate` by user adyyousf197#gmail.com
2021-07-13T18:28:21.919810+00:00 heroku[run.5856]: State changed from starting to up
7a-acd0aab16891 fwd="169.149.22.37" dyno= connect= service= status=503 bytes= protocol=https
2021-07-13T18:28:36.667998+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico"
host=heyady.herokuapp.com request_id=2896e5e2-150f-4d77-a0c2-ecf77ce4e5a2 fwd="169.149.22.37" dyno= connect= service= status=503 bytes= protocol=https
So after a lot of research and reading the Django docs, Heroku docs, StackOverflow articles I found that I was doing it wrong all the time and because I read similar articles where people have the same problem. Maybe this is going to help you:
The Procfile has no extensions.
You should be deploying through a virtual environment
the Procfile script is important and you need to add web: gunicorn myproject.wsgi where myproject is to be replaced by the name of your project.
Make sure the Procfile is within your root directory and not inside a project subfolder.
heroku logs --tail --app fooodie-bot2021
» Warning: heroku update available from 7.53.0 to 7.54.0.
2021-06-04T18:44:13.667090+00:00 heroku[web.1]: Starting process with command `gunicorn --bind 0.0.0.0:58344 app:app`
2021-06-04T18:44:17.360140+00:00 app[web.1]: [2021-06-04 18:44:17 +0000] [4] [INFO] Starting gunicorn 20.1.0
2021-06-04T18:44:17.360928+00:00 app[web.1]: [2021-06-04 18:44:17 +0000] [4] [INFO] Listening at: http://0.0.0.0:58344 (4)
2021-06-04T18:44:17.361067+00:00 app[web.1]: [2021-06-04 18:44:17 +0000] [4] [INFO] Using worker: sync
2021-06-04T18:44:17.367156+00:00 app[web.1]: [2021-06-04 18:44:17 +0000] [7] [INFO] Booting worker with pid: 7
2021-06-04T18:44:17.375131+00:00 app[web.1]: [2021-06-04 18:44:17 +0000] [7] [ERROR] Exception in worker process
2021-06-04T18:44:17.375145+00:00 app[web.1]: Traceback (most recent call last):
2021-06-04T18:44:17.375147+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2021-06-04T18:44:17.375148+00:00 app[web.1]: worker.init_process()
2021-06-04T18:44:17.375149+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2021-06-04T18:44:17.375149+00:00 app[web.1]: self.load_wsgi()
2021-06-04T18:44:17.375149+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2021-06-04T18:44:17.375150+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-06-04T18:44:17.375151+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-06-04T18:44:17.375152+00:00 app[web.1]: self.callable = self.load()
2021-06-04T18:44:17.375152+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2021-06-04T18:44:17.375152+00:00 app[web.1]: return self.load_wsgiapp()
2021-06-04T18:44:17.375153+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2021-06-04T18:44:17.375153+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-06-04T18:44:17.375154+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2021-06-04T18:44:17.375154+00:00 app[web.1]: mod = importlib.import_module(module)
2021-06-04T18:44:17.375154+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2021-06-04T18:44:17.375155+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-06-04T18:44:17.375155+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-06-04T18:44:17.375156+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-06-04T18:44:17.375156+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2021-06-04T18:44:17.375156+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-06-04T18:44:17.375384+00:00 app[web.1]: [2021-06-04 18:44:17 +0000] [7] [INFO] Worker exiting (pid: 7)
2021-06-04T18:44:17.435219+00:00 app[web.1]: [2021-06-04 18:44:17 +0000] [4] [INFO] Shutting down: Master
2021-06-04T18:44:17.435220+00:00 app[web.1]: [2021-06-04 18:44:17 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-06-04T18:44:17.529984+00:00 heroku[web.1]: Process exited with status 3
2021-06-04T18:44:17.603954+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-04T20:52:46.691043+00:00 heroku[web.1]: State changed from crashed to starting
2021-06-04T20:52:53.880135+00:00 heroku[web.1]: Starting process with command `gunicorn --bind 0.0.0.0:32290 app:app`
2021-06-04T20:52:57.015064+00:00 app[web.1]: [2021-06-04 20:52:57 +0000] [4] [INFO] Starting gunicorn 20.1.0
2021-06-04T20:52:57.015457+00:00 app[web.1]: [2021-06-04 20:52:57 +0000] [4] [INFO] Listening at: http://0.0.0.0:32290 (4)
2021-06-04T20:52:57.015537+00:00 app[web.1]: [2021-06-04 20:52:57 +0000] [4] [INFO] Using worker: sync
2021-06-04T20:52:57.019297+00:00 app[web.1]: [2021-06-04 20:52:57 +0000] [7] [INFO] Booting worker with pid: 7
2021-06-04T20:52:57.025214+00:00 app[web.1]: [2021-06-04 20:52:57 +0000] [7] [ERROR] Exception in worker process
2021-06-04T20:52:57.025215+00:00 app[web.1]: Traceback (most recent call last):
2021-06-04T20:52:57.025216+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2021-06-04T20:52:57.025216+00:00 app[web.1]: worker.init_process()
2021-06-04T20:52:57.025217+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2021-06-04T20:52:57.025217+00:00 app[web.1]: self.load_wsgi()
2021-06-04T20:52:57.025217+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2021-06-04T20:52:57.025218+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-06-04T20:52:57.025218+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-06-04T20:52:57.025219+00:00 app[web.1]: self.callable = self.load()
2021-06-04T20:52:57.025219+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2021-06-04T20:52:57.025219+00:00 app[web.1]: return self.load_wsgiapp()
2021-06-04T20:52:57.025220+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2021-06-04T20:52:57.025220+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-06-04T20:52:57.025220+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2021-06-04T20:52:57.025221+00:00 app[web.1]: mod = importlib.import_module(module)
2021-06-04T20:52:57.025221+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2021-06-04T20:52:57.025222+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-06-04T20:52:57.025222+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-06-04T20:52:57.025222+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-06-04T20:52:57.025223+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2021-06-04T20:52:57.025223+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-06-04T20:52:57.025357+00:00 app[web.1]: [2021-06-04 20:52:57 +0000] [7] [INFO] Worker exiting (pid: 7)
2021-06-04T20:52:57.060273+00:00 app[web.1]: [2021-06-04 20:52:57 +0000] [4] [INFO] Shutting down: Master
2021-06-04T20:52:57.060339+00:00 app[web.1]: [2021-06-04 20:52:57 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-06-04T20:52:57.136841+00:00 heroku[web.1]: Process exited with status 3
2021-06-04T20:52:57.214462+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-04T23:56:33.244581+00:00 heroku[web.1]: State changed from crashed to starting
2021-06-04T23:56:41.153062+00:00 heroku[web.1]: Starting process with command `gunicorn --bind 0.0.0.0:44202 app:app`
2021-06-04T23:56:45.069131+00:00 app[web.1]: [2021-06-04 23:56:45 +0000] [4] [INFO] Starting gunicorn 20.1.0
2021-06-04T23:56:45.069673+00:00 app[web.1]: [2021-06-04 23:56:45 +0000] [4] [INFO] Listening at: http://0.0.0.0:44202 (4)
2021-06-04T23:56:45.069777+00:00 app[web.1]: [2021-06-04 23:56:45 +0000] [4] [INFO] Using worker: sync
2021-06-04T23:56:45.073690+00:00 app[web.1]: [2021-06-04 23:56:45 +0000] [7] [INFO] Booting worker with pid: 7
2021-06-04T23:56:45.078553+00:00 app[web.1]: [2021-06-04 23:56:45 +0000] [7] [ERROR] Exception in worker process
2021-06-04T23:56:45.078582+00:00 app[web.1]: Traceback (most recent call last):
2021-06-04T23:56:45.078588+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2021-06-04T23:56:45.078594+00:00 app[web.1]: worker.init_process()
2021-06-04T23:56:45.078594+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2021-06-04T23:56:45.078595+00:00 app[web.1]: self.load_wsgi()
2021-06-04T23:56:45.078595+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2021-06-04T23:56:45.078595+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-06-04T23:56:45.078600+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-06-04T23:56:45.078601+00:00 app[web.1]: self.callable = self.load()
2021-06-04T23:56:45.078601+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2021-06-04T23:56:45.078601+00:00 app[web.1]: return self.load_wsgiapp()
2021-06-04T23:56:45.078602+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2021-06-04T23:56:45.078602+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-06-04T23:56:45.078602+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2021-06-04T23:56:45.078603+00:00 app[web.1]: mod = importlib.import_module(module)
2021-06-04T23:56:45.078603+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2021-06-04T23:56:45.078604+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-06-04T23:56:45.078604+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-06-04T23:56:45.078605+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-06-04T23:56:45.078605+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2021-06-04T23:56:45.078605+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2021-06-04T23:56:45.078700+00:00 app[web.1]: [2021-06-04 23:56:45 +0000] [7] [INFO] Worker exiting (pid: 7)
2021-06-04T23:56:45.117467+00:00 app[web.1]: [2021-06-04 23:56:45 +0000] [4] [INFO] Shutting down: Master
2021-06-04T23:56:45.117651+00:00 app[web.1]: [2021-06-04 23:56:45 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-06-04T23:56:45.231963+00:00 heroku[web.1]: Process exited with status 3
2021-06-04T23:56:45.388008+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-05T03:47:07.088448+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fooodie-bot2021.herokuapp.com request_id=aa2aa16a-bb5f-44d6-a6ea-4083e463693f fwd="42.106.107.86" dyno= connect= service= status=503 bytes= protocol=https
2021-06-05T03:47:07.663226+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fooodie-bot2021.herokuapp.com request_id=4e065a27-291a-4498-b690-f70f0df250cc fwd="42.106.107.86" dyno= connect= service= status=503 bytes= protocol=https
Error says there is no module named app, please check if your python file is named app and has Flask instance equal to app.
I was making a Django web app using pipenv, the Application error window pops up whenever i try running 'heroku open', please help i am stuck in deploying this for over one month and have tried almost every possible solution that was available online but the error still persists. please help.
Running'heroku logs --tail' shows:
$ heroku logs --tail
2021-02-17T17:50:51.188410+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2021-02-17T17:50:51.297606+00:00 heroku[web.1]: Process exited with status 1
2021-02-17T17:50:51.389796+00:00 heroku[web.1]: State changed from starting to crashed
2021-02-17T17:50:53.000000+00:00 app[api]: Build succeeded
2021-02-17T17:51:39.619675+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=bloggero.herokuapp.com request_id=ecbd78a2-5542-4d08-87f7-e7d12404ae9b fwd="223.239.61.176" dyno= connect= service= status=503 bytes= protocol=https
2021-02-17T17:51:41.855171+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=bloggero.herokuapp.com request_id=42dd37d3-ad4b-43dc-956d-41d34bf03ffd fwd="223.239.61.176" dyno= connect= service= status=503 bytes= protocol=https
2021-02-17T18:04:58.000000+00:00 app[api]: Build started by user ad******#gmail.com
2021-02-17T18:05:29.716771+00:00 app[api]: Deploy 879be0de by user a******#gmail.com
2021-02-17T18:05:29.716771+00:00 app[api]: Release v19 created by user a*******#gmail.com
2021-02-17T18:05:30.074089+00:00 heroku[web.1]: State changed from crashed to starting
2021-02-17T18:05:35.396728+00:00 heroku[web.1]: Starting process with command `gunicorn mysite.wsgi`
2021-02-17T18:05:37.756029+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [4] [INFO] Starting gunicorn 20.0.4
2021-02-17T18:05:37.756584+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [4] [INFO] Listening at: http://0.0.0.0:17786 (4)
2021-02-17T18:05:37.756675+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [4] [INFO] Using worker: sync
2021-02-17T18:05:37.761624+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [9] [INFO] Booting worker with pid: 9
2021-02-17T18:05:37.770211+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [9] [ERROR] Exception in worker process
2021-02-17T18:05:37.770213+00:00 app[web.1]: Traceback (most recent call last):
2021-02-17T18:05:37.770232+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-02-17T18:05:37.770233+00:00 app[web.1]: worker.init_process()
2021-02-17T18:05:37.770234+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-02-17T18:05:37.770234+00:00 app[web.1]: self.load_wsgi()
2021-02-17T18:05:37.770234+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-02-17T18:05:37.770235+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-02-17T18:05:37.770235+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-02-17T18:05:37.770236+00:00 app[web.1]: self.callable = self.load()
2021-02-17T18:05:37.770236+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-02-17T18:05:37.770236+00:00 app[web.1]: return self.load_wsgiapp()
2021-02-17T18:05:37.770237+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-02-17T18:05:37.770237+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-02-17T18:05:37.770238+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
2021-02-17T18:05:37.770238+00:00 app[web.1]: mod = importlib.import_module(module)
2021-02-17T18:05:37.770238+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/importlib/__init__.py", line 127, in import_module
2021-02-17T18:05:37.770239+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-02-17T18:05:37.770239+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
2021-02-17T18:05:37.770240+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 983, in _find_and_load
2021-02-17T18:05:37.770240+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
2021-02-17T18:05:37.770240+00:00 app[web.1]: ModuleNotFoundError: No module named 'mysite.wsgi'
2021-02-17T18:05:37.770465+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-02-17T18:05:37.779801+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [10] [INFO] Booting worker with pid: 10
2021-02-17T18:05:37.785931+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [10] [ERROR] Exception in worker process
2021-02-17T18:05:37.785933+00:00 app[web.1]: Traceback (most recent call last):
2021-02-17T18:05:37.785934+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-02-17T18:05:37.785934+00:00 app[web.1]: worker.init_process()
2021-02-17T18:05:37.785934+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-02-17T18:05:37.785935+00:00 app[web.1]: self.load_wsgi()
2021-02-17T18:05:37.785935+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-02-17T18:05:37.785936+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-02-17T18:05:37.785937+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-02-17T18:05:37.785937+00:00 app[web.1]: self.callable = self.load()
2021-02-17T18:05:37.785937+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-02-17T18:05:37.785938+00:00 app[web.1]: return self.load_wsgiapp()
2021-02-17T18:05:37.785938+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-02-17T18:05:37.785939+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-02-17T18:05:37.785939+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
2021-02-17T18:05:37.785939+00:00 app[web.1]: mod = importlib.import_module(module)
2021-02-17T18:05:37.785940+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/importlib/__init__.py", line 127, in import_module
2021-02-17T18:05:37.785940+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-02-17T18:05:37.785941+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
2021-02-17T18:05:37.785941+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 983, in _find_and_load
2021-02-17T18:05:37.785941+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
2021-02-17T18:05:37.785942+00:00 app[web.1]: ModuleNotFoundError: No module named 'mysite.wsgi'
2021-02-17T18:05:37.786104+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [10] [INFO] Worker exiting (pid: 10)
2021-02-17T18:05:37.906870+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [4] [INFO] Shutting down: Master
2021-02-17T18:05:37.906946+00:00 app[web.1]: [2021-02-17 18:05:37 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-02-17T18:05:37.987061+00:00 heroku[web.1]: Process exited with status 3
2021-02-17T18:05:38.059333+00:00 heroku[web.1]: State changed from starting to crashed
2021-02-17T18:05:38.062623+00:00 heroku[web.1]: State changed from crashed to starting
2021-02-17T18:05:41.000000+00:00 app[api]: Build succeeded
2021-02-17T18:05:48.981104+00:00 heroku[web.1]: Starting process with command `gunicorn mysite.wsgi`
2021-02-17T18:05:52.073363+00:00 app[web.1]: [2021-02-17 18:05:52 +0000] [4] [INFO] Starting gunicorn 20.0.4
2021-02-17T18:05:52.074407+00:00 app[web.1]: [2021-02-17 18:05:52 +0000] [4] [INFO] Listening at: http://0.0.0.0:45799 (4)
2021-02-17T18:05:52.074661+00:00 app[web.1]: [2021-02-17 18:05:52 +0000] [4] [INFO] Using worker: sync
2021-02-17T18:05:52.082772+00:00 app[web.1]: [2021-02-17 18:05:52 +0000] [9] [INFO] Booting worker with pid: 9
2021-02-17T18:05:52.096292+00:00 app[web.1]: [2021-02-17 18:05:52 +0000] [9] [ERROR] Exception in worker process
2021-02-17T18:05:52.096293+00:00 app[web.1]: Traceback (most recent call last):
2021-02-17T18:05:52.096302+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-02-17T18:05:52.096303+00:00 app[web.1]: worker.init_process()
2021-02-17T18:05:52.096303+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-02-17T18:05:52.096303+00:00 app[web.1]: self.load_wsgi()
2021-02-17T18:05:52.096304+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-02-17T18:05:52.096304+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-02-17T18:05:52.096304+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-02-17T18:05:52.096305+00:00 app[web.1]: self.callable = self.load()
2021-02-17T18:05:52.096305+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-02-17T18:05:52.096306+00:00 app[web.1]: return self.load_wsgiapp()
2021-02-17T18:05:52.096306+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-02-17T18:05:52.096306+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-02-17T18:05:52.096307+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
2021-02-17T18:05:52.096307+00:00 app[web.1]: mod = importlib.import_module(module)
2021-02-17T18:05:52.096307+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/importlib/__init__.py", line 127, in import_module
2021-02-17T18:05:52.096308+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-02-17T18:05:52.096308+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
2021-02-17T18:05:52.096309+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 983, in _find_and_load
2021-02-17T18:05:52.096309+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
2021-02-17T18:05:52.096310+00:00 app[web.1]: ModuleNotFoundError: No module named 'mysite.wsgi'
2021-02-17T18:05:52.096657+00:00 app[web.1]: [2021-02-17 18:05:52 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-02-17T18:05:52.131656+00:00 app[web.1]: [2021-02-17 18:05:52 +0000] [4] [INFO] Shutting down: Master
2021-02-17T18:05:52.131783+00:00 app[web.1]: [2021-02-17 18:05:52 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-02-17T18:05:52.238783+00:00 heroku[web.1]: Process exited with status 3
2021-02-17T18:05:52.335630+00:00 heroku[web.1]: State changed from starting to crashed
I checked the Procfile and it looks :
web: gunicorn mysite.wsgi
And here is the wsgi.py module:
from helloworld.wsgi import HelloWorldApplication
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
application = get_wsgi_application()
application = HelloWorldApplication(application)
The project structure is as follows-
And i have already installed gunicorn and other requirements which can be seen here in the pipfile:-
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
asgiref = "==3.2.10"
django-crispy-forms = "==1.10.0"
pytz = "==2020.4"
sqlparse = "==0.4.1"
Django = "==3.1"
Pillow = "==8.0.1"
gunicorn = "*"
[requires]
python_version = "3.7"
From a quick google search I found another thread with a similar question. The answers seem to indicate that you need to add your project directory in your python path.
First, import the sys module.
import sys
Now, right before the os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') line, add:
path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if path not in sys.path:
sys.path.append(path)
This code snippet grabs the absolute path to your project directory and appends it to your python path if it is not already there.
Also, I second Field Boy's response that you should consider a linux server.
Please don't waste your time with heroku, you will always run into problems, even after your app started fine, if your app is fairly large. Use a virtual machine (check digital ocean or linode they have free $100 credit) and your app will run just like on your laptop. Look for Corey Schafer Django deployment on linux server on youtube on how to set up Apache2 virtual server on the linux server.