Nginx 502 Bad gateway - gcp - django

I am trying to deploy my Django website on google cloud using tutorial (https://cloud.google.com/python/django/appengine#cloud-console)
My website is working smoothly on local host as well on Heroku (Free).
But when i try to deploy my website on GCP, deployment finishes without any error. But access to website using the link provided by GCP gives mei 'nginx 502 Bad Gateway' error.
I assume, error is because its listening to 'http://0.0.0.0:8081'. Can anyone please help.
Below are my logs:
Traceback from GCP website.
2020-06-20 12:02:57.759 IST
Traceback (most recent call last): File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker worker.init_process() File "/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 92, in init_process super().init_process() File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process self.load_wsgi() File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi self.wsgi = self.app.wsgi() File "/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load return self.load_wsgiapp() File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp return util.import_app(self.app_uri) File "/env/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app mod = importlib.import_module(module) File "/opt/python3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'main'
Expand all | Collapse all{
insertId: "5eedad99000b96b31054c1f8"
labels: {
clone_id: "00c61b117ceed98b6a28aa8b70411a0a5acbb82696fd9c6894b1680eeaf75adfbafe66"
}
logName: "projects/school-website-272007/logs/stderr"
receiveTimestamp: "2020-06-20T06:32:57.952414554Z"
resource: {
labels: {
module_id: "default"
project_id: "school-website-272007"
version_id: "20200620t115649"
zone: "asia-south1-2"
}
type: "gae_app"
}
textPayload: "Traceback (most recent call last):
File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
super().init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/env/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/opt/python3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'main'"
timestamp: "2020-06-20T06:32:57.759475Z"
}
After GCP deploy and 'gcloud app logs tail -s default' generates log as below.
2020-06-20 06:51:07 default[20200620t115649] Traceback (most recent call last): File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker worker.init_process() File "/env/lib/python3.7/site-p
ackages/gunicorn/workers/gthread.py", line 92, in init_process super().init_process() File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process self.load_wsgi() File "/env/lib/python
3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi self.wsgi = self.app.wsgi() File "/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/env/li
b/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load return self.load_wsgiapp() File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp return util.import_app(self.app_u
ri) File "/env/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app mod = importlib.import_module(module) File "/opt/python3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module return
_bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", l
ine 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'main'
2020-06-20 06:51:07 default[20200620t115649] [2020-06-20 06:51:07 +0000] [21] [INFO] Worker exiting (pid: 21)
2020-06-20 06:51:07 default[20200620t115649] [2020-06-20 06:51:07 +0000] [7] [INFO] Shutting down: Master
2020-06-20 06:51:07 default[20200620t115649] [2020-06-20 06:51:07 +0000] [7] [INFO] Reason: Worker failed to boot.
2020-06-20 06:51:08 default[20200620t115649] "GET /favicon.ico HTTP/1.1" 502
2020-06-20 06:51:09 default[20200620t115649] [2020-06-20 06:51:09 +0000] [7] [INFO] Starting gunicorn 20.0.4
2020-06-20 06:51:09 default[20200620t115649] [2020-06-20 06:51:09 +0000] [7] [INFO] Listening at: http://0.0.0.0:8081 (7)
2020-06-20 06:51:09 default[20200620t115649] [2020-06-20 06:51:09 +0000] [7] [INFO] Using worker: threads
2020-06-20 06:51:09 default[20200620t115649] [2020-06-20 06:51:09 +0000] [18] [INFO] Booting worker with pid: 18
2020-06-20 06:51:09 default[20200620t115649] [2020-06-20 06:51:09 +0000] [18] [ERROR] Exception in worker process
2020-06-20 06:51:09 default[20200620t115649] Traceback (most recent call last): File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker worker.init_process() File "/env/lib/python3.7/site-p
ackages/gunicorn/workers/gthread.py", line 92, in init_process super().init_process() File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process self.load_wsgi() File "/env/lib/python
3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi self.wsgi = self.app.wsgi() File "/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/env/li
b/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load return self.load_wsgiapp() File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp return util.import_app(self.app_u
ri) File "/env/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app mod = importlib.import_module(module) File "/opt/python3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module return
_bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", l
ine 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'main'
2020-06-20 06:51:09 default[20200620t115649] [2020-06-20 06:51:09 +0000] [18] [INFO] Worker exiting (pid: 18)
2020-06-20 06:51:09 default[20200620t115649] [2020-06-20 06:51:09 +0000] [22] [INFO] Booting worker with pid: 22
2020-06-20 06:51:09 default[20200620t115649] [2020-06-20 06:51:09 +0000] [22] [ERROR] Exception in worker process
2020-06-20 06:51:09 default[20200620t115649] Traceback (most recent call last): File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker worker.init_process() File "/env/lib/python3.7/site-p
ackages/gunicorn/workers/gthread.py", line 92, in init_process super().init_process() File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process self.load_wsgi() File "/env/lib/python
3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi self.wsgi = self.app.wsgi() File "/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/env/li
b/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load return self.load_wsgiapp() File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp return util.import_app(self.app_u
ri) File "/env/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app mod = importlib.import_module(module) File "/opt/python3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module return
_bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", l
ine 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'main'
2020-06-20 06:51:09 default[20200620t115649] [2020-06-20 06:51:09 +0000] [22] [INFO] Worker exiting (pid: 22)
2020-06-20 06:51:09 default[20200620t115649] Traceback (most recent call last): File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 209, in run self.sleep() File "/env/lib/python3.7/site-packages/gunicorn/a
rbiter.py", line 357, in sleep ready = select.select([self.PIPE[0]], [], [], 1.0) File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 242, in handle_chld self.reap_workers() File "/env/lib/python3.7/sit
e-packages/gunicorn/arbiter.py", line 525, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2020-06-20 06:51:09 default[20200620t115649]
2020-06-20 06:51:09 default[20200620t115649] During handling of the above exception, another exception occurred:
2020-06-20 06:51:09 default[20200620t115649]
2020-06-20 06:51:09 default[20200620t115649] Traceback (most recent call last): File "/env/bin/gunicorn", line 10, in <module> sys.exit(run()) File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 58, in
run WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() File "/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 228, in run super().run() File "/env/lib/python3.7/site-packages/gunicorn/app/base.py",
line 72, in run Arbiter(self).run() File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 229, in run self.halt(reason=inst.reason, exit_status=inst.exit_status) File "/env/lib/python3.7/site-packages/gun
icorn/arbiter.py", line 342, in halt self.stop() File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 393, in stop time.sleep(0.1) File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 242, i
n handle_chld self.reap_workers() File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 525, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer: <HaltServer 'Worker
failed to boot.' 3>

Thanks to Ed. Kenbers, I have fixed my issue. Below are the steps to rectify the issue.
Create a file main.py in root directory where app.yaml is present and add as below:
from <your app name>.wsgi import application
app = application
In app.yaml file add below line:
entrypoint: gunicorn -b :$PORT <your app name>.wsgi
In setttings.py file, in ALLOWED HOSTS add your GCP website link which comes once you deploy the application like 'Deployed service [default] to [https://< your project name >.el.r.appspot.com]'
ALLOWED_HOSTS = ["< your project name >.el.r.appspot.com",]

Related

Error code=H10 desc="App Crashed" when trying to deploy my Flask app onto Heroku

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.

Heroku Flask app crashes before it even starts [duplicate]

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

Heroku - Django - the application loading process fails

I've been browsing all the options and advice on the internet for 14 days and I can't help it, please help me how to run a properly installed application on Heroku? I'm creating an application on Windows10 and I can't run "gunicorn" there locally, unfortunately, how do I debug or where am I making a mistake...?
2022-03-08T17:05:18.069332+00:00 heroku[web.1]: State changed from up to crashed
2022-03-08T17:05:18.091002+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-08T17:05:17.994885+00:00 heroku[web.1]: Process exited with status 1
2022-03-08T17:05:24.550895+00:00 heroku[web.1]: Starting process with command gunicorn final_sda_project.wsgi --log-file -
2022-03-08T17:05:26.835207+00:00 heroku[web.1]: State changed from starting to up
2022-03-08T17:05:26.291724+00:00 app[web.1]: [2022-03-08 17:05:26 +0000] [4] [INFO] Starting gunicorn 20.1.0
2022-03-08T17:05:26.292294+00:00 app[web.1]: [2022-03-08 17:05:26 +0000] [4] [INFO] Listening at: http://0.0.0.0:12794 (4)
2022-03-08T17:05:26.292350+00:00 app[web.1]: [2022-03-08 17:05:26 +0000] [4] [INFO] Using worker: sync
2022-03-08T17:05:26.296152+00:00 app[web.1]: [2022-03-08 17:05:26 +0000] [9] [INFO] Booting worker with pid: 9
2022-03-08T17:05:26.399828+00:00 app[web.1]: [2022-03-08 17:05:26 +0000] [10] [INFO] Booting worker with pid: 10
2022-03-08T17:05:26.442367+00:00 app[web.1]: [2022-03-08 17:05:26 +0000] [11] [INFO] Booting worker with pid: 11
2022-03-08T17:05:27.924052+00:00 app[web.1]: [2022-03-08 17:05:27 +0000] [11] [ERROR] Exception in worker process
2022-03-08T17:05:27.924073+00:00 app[web.1]: Traceback (most recent call last):
2022-03-08T17:05:27.924074+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-03-08T17:05:27.924074+00:00 app[web.1]: worker.init_process()
2022-03-08T17:05:27.924075+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2022-03-08T17:05:27.924075+00:00 app[web.1]: self.load_wsgi()
2022-03-08T17:05:27.924075+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-03-08T17:05:27.924076+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-03-08T17:05:27.924077+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-03-08T17:05:27.924077+00:00 app[web.1]: self.callable = self.load()
2022-03-08T17:05:27.924077+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-03-08T17:05:27.924077+00:00 app[web.1]: return self.load_wsgiapp()
2022-03-08T17:05:27.924078+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-03-08T17:05:27.924078+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-03-08T17:05:27.924078+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2022-03-08T17:05:27.924079+00:00 app[web.1]: mod = importlib.import_module(module)
2022-03-08T17:05:27.924079+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/init.py", line 127, in import_module
2022-03-08T17:05:27.924079+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-03-08T17:05:27.924080+00:00 app[web.1]: File "", line 1030, in _gcd_import
2022-03-08T17:05:27.924080+00:00 app[web.1]: File "", line 1007, in _find_and_load
2022-03-08T17:05:27.924081+00:00 app[web.1]: File "", line 986, in _find_and_load_unlocked
2022-03-08T17:05:27.924081+00:00 app[web.1]: File "", line 680, in _load_unlocked
2022-03-08T17:05:27.924081+00:00 app[web.1]: File "", line 850, in exec_module
2022-03-08T17:05:27.924081+00:00 app[web.1]: File "", line 228, in _call_with_frames_removed
2022-03-08T17:05:27.924082+00:00 app[web.1]: File "/app/final_sda_project/wsgi.py", line 16, in
2022-03-08T17:05:27.924082+00:00 app[web.1]: application = get_wsgi_application()
2022-03-08T17:05:27.924082+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2022-03-08T17:05:27.924082+00:00 app[web.1]: django.setup(set_prefix=False)
2022-03-08T17:05:27.924083+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/init.py", line 19, in setup
2022-03-08T17:05:27.924083+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2022-03-08T17:05:27.924083+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/init.py", line 87, in getattr
2022-03-08T17:05:27.924083+00:00 app[web.1]: self._setup(name)
2022-03-08T17:05:27.924084+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/init.py", line 74, in _setup
2022-03-08T17:05:27.924084+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2022-03-08T17:05:27.924084+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/init.py", line 183, in init
2022-03-08T17:05:27.924084+00:00 app[web.1]: mod = importlib.import_module(self.SETTINGS_MODULE)
2022-03-08T17:05:27.924085+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/init.py", line 127, in import_module
2022-03-08T17:05:27.924085+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-03-08T17:05:27.924085+00:00 app[web.1]: File "", line 1030, in _gcd_import
2022-03-08T17:05:27.924085+00:00 app[web.1]: File "", line 1007, in _find_and_load
2022-03-08T17:05:27.924086+00:00 app[web.1]: File "", line 986, in _find_and_load_unlocked
2022-03-08T17:05:27.924086+00:00 app[web.1]: File "", line 680, in _load_unlocked
2022-03-08T17:05:27.924086+00:00 app[web.1]: File "", line 850, in exec_module
2022-03-08T17:05:27.924086+00:00 app[web.1]: File "", line 228, in _call_with_frames_removed
2022-03-08T17:05:27.924086+00:00 app[web.1]: File "/app/final_sda_project/settings.py", line 154, in
2022-03-08T17:05:27.924087+00:00 app[web.1]: django_heroku.settings(locals())
2022-03-08T17:05:27.924087+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django_heroku/core.py", line 69, in settings
2022-03-08T17:05:27.924087+00:00 app[web.1]: config['DATABASES']['default'] = dj_database_url.config(conn_max_age=MAX_CONN_AGE, ssl_require=True)
2022-03-08T17:05:27.924088+00:00 app[web.1]: TypeError: config() got an unexpected keyword argument 'conn_max_age'
2022-03-08T17:05:27.924305+00:00 app[web.1]: [2022-03-08 17:05:27 +0000] [11] [INFO] Worker exiting (pid: 11)
2022-03-08T17:05:27.935940+00:00 app[web.1]: [2022-03-08 17:05:27 +0000] [10] [ERROR] Exception in worker process
2022-03-08T17:05:27.935942+00:00 app[web.1]: Traceback (most recent call last):
2022-03-08T17:05:27.935942+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-03-08T17:05:27.935943+00:00 app[web.1]: worker.init_process()
2022-03-08T17:05:27.935943+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2022-03-08T17:05:27.935944+00:00 app[web.1]: self.load_wsgi()
2022-03-08T17:05:27.935944+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-03-08T17:05:27.935945+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-03-08T17:05:27.935945+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-03-08T17:05:27.935946+00:00 app[web.1]: self.callable = self.load()
2022-03-08T17:05:27.935946+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-03-08T17:05:27.935946+00:00 app[web.1]: return self.load_wsgiapp()
2022-03-08T17:05:27.935947+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-03-08T17:05:27.935947+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-03-08T17:05:27.935947+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2022-03-08T17:05:27.935947+00:00 app[web.1]: mod = importlib.import_module(module)
2022-03-08T17:05:27.935948+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/init.py", line 127, in import_module
2022-03-08T17:05:27.935948+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-03-08T17:05:27.935949+00:00 app[web.1]: File "", line 1030, in _gcd_import
2022-03-08T17:05:27.935949+00:00 app[web.1]: File "", line 1007, in _find_and_load
2022-03-08T17:05:27.935949+00:00 app[web.1]: File "", line 986, in _find_and_load_unlocked
2022-03-08T17:05:27.935949+00:00 app[web.1]: File "", line 680, in _load_unlocked
2022-03-08T17:05:27.935950+00:00 app[web.1]: File "", line 850, in exec_module
2022-03-08T17:05:27.935950+00:00 app[web.1]: File "", line 228, in _call_with_frames_removed
2022-03-08T17:05:27.935950+00:00 app[web.1]: File "/app/final_sda_project/wsgi.py", line 16, in
2022-03-08T17:05:27.935950+00:00 app[web.1]: application = get_wsgi_application()
2022-03-08T17:05:27.935951+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2022-03-08T17:05:27.935951+00:00 app[web.1]: django.setup(set_prefix=False)
2022-03-08T17:05:27.935951+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/init.py", line 19, in setup
2022-03-08T17:05:27.935951+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2022-03-08T17:05:27.935952+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/init.py", line 87, in getattr
2022-03-08T17:05:27.935952+00:00 app[web.1]: self._setup(name)
2022-03-08T17:05:27.935952+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/init.py", line 74, in _setup
2022-03-08T17:05:27.935953+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2022-03-08T17:05:27.935953+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/init.py", line 183, in init
2022-03-08T17:05:27.935953+00:00 app[web.1]: mod = importlib.import_module(self.SETTINGS_MODULE)
2022-03-08T17:05:27.935961+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/init.py", line 127, in import_module
2022-03-08T17:05:27.935961+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-03-08T17:05:27.935961+00:00 app[web.1]: File "", line 1030, in _gcd_import
2022-03-08T17:05:27.935961+00:00 app[web.1]: File "", line 1007, in _find_and_load
2022-03-08T17:05:27.935962+00:00 app[web.1]: File "", line 986, in _find_and_load_unlocked
2022-03-08T17:05:27.935962+00:00 app[web.1]: File "", line 680, in _load_unlocked
2022-03-08T17:05:27.935962+00:00 app[web.1]: File "", line 850, in exec_module
2022-03-08T17:05:27.935962+00:00 app[web.1]: File "", line 228, in _call_with_frames_removed
2022-03-08T17:05:27.935963+00:00 app[web.1]: File "/app/final_sda_project/settings.py", line 154, in
2022-03-08T17:05:27.935963+00:00 app[web.1]: django_heroku.settings(locals())
2022-03-08T17:05:27.935963+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django_heroku/core.py", line 69, in settings
2022-03-08T17:05:27.935964+00:00 app[web.1]: config['DATABASES']['default'] = dj_database_url.config(conn_max_age=MAX_CONN_AGE, ssl_require=True)
2022-03-08T17:05:27.935964+00:00 app[web.1]: TypeError: config() got an unexpected keyword argument 'conn_max_age'
2022-03-08T17:05:27.936163+00:00 app[web.1]: [2022-03-08 17:05:27 +0000] [10] [INFO] Worker exiting (pid: 10)
2022-03-08T17:05:27.946046+00:00 app[web.1]: [2022-03-08 17:05:27 +0000] [9] [ERROR] Exception in worker process
2022-03-08T17:05:27.946048+00:00 app[web.1]: Traceback (most recent call last):
2022-03-08T17:05:27.946049+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-03-08T17:05:27.946050+00:00 app[web.1]: worker.init_process()
2022-03-08T17:05:27.946050+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2022-03-08T17:05:27.946051+00:00 app[web.1]: self.load_wsgi()
2022-03-08T17:05:27.946051+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-03-08T17:05:27.946051+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-03-08T17:05:27.946052+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-03-08T17:05:27.946052+00:00 app[web.1]: self.callable = self.load()
2022-03-08T17:05:27.946053+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-03-08T17:05:27.946054+00:00 app[web.1]: return self.load_wsgiapp()
2022-03-08T17:05:27.946054+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-03-08T17:05:27.946054+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-03-08T17:05:27.946060+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2022-03-08T17:05:27.946060+00:00 app[web.1]: mod = importlib.import_module(module)
2022-03-08T17:05:27.946061+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/init.py", line 127, in import_module
2022-03-08T17:05:27.946061+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-03-08T17:05:27.946062+00:00 app[web.1]: File "", line 1030, in _gcd_import
2022-03-08T17:05:27.946062+00:00 app[web.1]: File "", line 1007, in _find_and_load
2022-03-08T17:05:27.946062+00:00 app[web.1]: File "", line 986, in _find_and_load_unlocked
2022-03-08T17:05:27.946063+00:00 app[web.1]: File "", line 680, in _load_unlocked
2022-03-08T17:05:27.946063+00:00 app[web.1]: File "", line 850, in exec_module
2022-03-08T17:05:27.946063+00:00 app[web.1]: File "", line 228, in _call_with_frames_removed
2022-03-08T17:05:27.946064+00:00 app[web.1]: File "/app/final_sda_project/wsgi.py", line 16, in
2022-03-08T17:05:27.946064+00:00 app[web.1]: application = get_wsgi_application()
2022-03-08T17:05:27.946064+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2022-03-08T17:05:27.946065+00:00 app[web.1]: django.setup(set_prefix=False)
2022-03-08T17:05:27.946065+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/init.py", line 19, in setup
2022-03-08T17:05:27.946065+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2022-03-08T17:05:27.946065+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/init.py", line 87, in getattr
2022-03-08T17:05:27.946066+00:00 app[web.1]: self._setup(name)
2022-03-08T17:05:27.946066+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/init.py", line 74, in _setup
2022-03-08T17:05:27.946066+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2022-03-08T17:05:27.946067+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/conf/init.py", line 183, in init
2022-03-08T17:05:27.946067+00:00 app[web.1]: mod = importlib.import_module(self.SETTINGS_MODULE)
2022-03-08T17:05:27.946067+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/init.py", line 127, in import_module
2022-03-08T17:05:27.946068+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-03-08T17:05:27.946068+00:00 app[web.1]: File "", line 1030, in _gcd_import
2022-03-08T17:05:27.946068+00:00 app[web.1]: File "", line 1007, in _find_and_load
2022-03-08T17:05:27.946069+00:00 app[web.1]: File "", line 986, in _find_and_load_unlocked
2022-03-08T17:05:27.946069+00:00 app[web.1]: File "", line 680, in _load_unlocked
2022-03-08T17:05:27.946069+00:00 app[web.1]: File "", line 850, in exec_module
2022-03-08T17:05:27.946070+00:00 app[web.1]: File "", line 228, in _call_with_frames_removed
2022-03-08T17:05:27.946070+00:00 app[web.1]: File "/app/final_sda_project/settings.py", line 154, in
2022-03-08T17:05:27.946070+00:00 app[web.1]: django_heroku.settings(locals())
2022-03-08T17:05:27.946071+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django_heroku/core.py", line 69, in settings
2022-03-08T17:05:27.946071+00:00 app[web.1]: config['DATABASES']['default'] = dj_database_url.config(conn_max_age=MAX_CONN_AGE, ssl_require=True)
2022-03-08T17:05:27.946071+00:00 app[web.1]: TypeError: config() got an unexpected keyword argument 'conn_max_age'
2022-03-08T17:05:27.946283+00:00 app[web.1]: [2022-03-08 17:05:27 +0000] [9] [INFO] Worker exiting (pid: 9)
2022-03-08T17:05:28.022283+00:00 app[web.1]: [2022-03-08 17:05:28 +0000] [4] [WARNING] Worker with pid 10 was terminated due to signal 15
2022-03-08T17:05:28.026103+00:00 app[web.1]: [2022-03-08 17:05:28 +0000] [4] [WARNING] Worker with pid 9 was terminated due to signal 15
2022-03-08T17:05:28.115867+00:00 app[web.1]: [2022-03-08 17:05:28 +0000] [4] [INFO] Shutting down: Master
2022-03-08T17:05:28.116159+00:00 app[web.1]: [2022-03-08 17:05:28 +0000] [4] [INFO] Reason: Worker failed to boot.
2022-03-08T17:05:28.373912+00:00 heroku[web.1]: Process exited with status 3
2022-03-08T17:05:28.561601+00:00 heroku[web.1]: State changed from up to crashed
Check line 69 in your settings.py file, it is not getting the default database.
As you can see from the error code
08T17:05:27.946071+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django_heroku/core.py", line 69, in settings 2022-03-08T17:05:27.946071+00:00 app[web.1]: config['DATABASES']['default'] =

ModuleNotFoundError: No module named 'onlineMenu/wsgi'

I was going to host it using Heroku. But it does not work because of the problem with the profile.
This my Procfile
web: gunicorn onlineMenu.wsgi --log-file -
my wsgi.py code
"""
WSGI config for onlineMenu project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'onlineMenu.settings')
application = get_wsgi_application()
this is my Heroku log (not all)
2020-10-23T16:04:08.861587+00:00 app[web.1]: Traceback (most recent
call last): 2020-10-23T16:04:08.861588+00:00 app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py",
line 583, in spawn_worker 2020-10-23T16:04:08.861588+00:00 app[web.1]:
worker.init_process() 2020-10-23T16:04:08.861589+00:00 app[web.1]:
File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py",
line 119, in init_process 2020-10-23T16:04:08.861589+00:00 app[web.1]:
self.load_wsgi() 2020-10-23T16:04:08.861589+00:00 app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py",
line 144, in load_wsgi 2020-10-23T16:04:08.861590+00:00 app[web.1]:
self.wsgi = self.app.wsgi() 2020-10-23T16:04:08.861590+00:00
app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py",
line 67, in wsgi 2020-10-23T16:04:08.861590+00:00 app[web.1]:
self.callable = self.load() 2020-10-23T16:04:08.861591+00:00
app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py",
line 49, in load 2020-10-23T16:04:08.861591+00:00 app[web.1]: return
self.load_wsgiapp() 2020-10-23T16:04:08.861591+00:00 app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py",
line 39, in load_wsgiapp 2020-10-23T16:04:08.861592+00:00 app[web.1]:
return util.import_app(self.app_uri) 2020-10-23T16:04:08.861592+00:00
app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/util.py",
line 358, in import_app 2020-10-23T16:04:08.861592+00:00 app[web.1]:
mod = importlib.import_module(module) 2020-10-23T16:04:08.861593+00:00
app[web.1]: File
"/app/.heroku/python/lib/python3.8/importlib/init.py", line 127,
in import_module 2020-10-23T16:04:08.861593+00:00 app[web.1]: return
_bootstrap._gcd_import(name[level:], package, level) 2020-10-23T16:04:08.861593+00:00 app[web.1]: File "", line 1014, in _gcd_import
2020-10-23T16:04:08.861594+00:00 app[web.1]: File "", line 991, in _find_and_load
2020-10-23T16:04:08.861594+00:00 app[web.1]: File "", line 973, in _find_and_load_unlocked
2020-10-23T16:04:08.861594+00:00 app[web.1]: ModuleNotFoundError: No
module named 'onlineMenu/wsgi' 2020-10-23T16:04:08.861841+00:00
app[web.1]: [2020-10-23 16:04:08 +0000] [10] [INFO] Worker exiting
(pid: 10) 2020-10-23T16:04:09.011977+00:00 app[web.1]: [2020-10-23
16:04:09 +0000] [4] [INFO] Shutting down: Master
2020-10-23T16:04:09.012166+00:00 app[web.1]: [2020-10-23 16:04:09
+0000] [4] [INFO] Reason: Worker failed to boot.

Django3.x - Heroku - raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")

I need your help colleagues. I am trying to deploy my Django Project on Heroku but I am getting a seemingly simple error but I have struggled to debug it for days. I would appreciate detailed help, I am a newbie. Thanking you in advance.
Background I have hidden foldername because it is also a domainname I want to register.
I have python 3.6.8 and Django 2.1.1 on a windows10 machine and Heroku PaaS. At first I was using Django 2.2 then downgraded to Django 2.1. by command pipenv install djang0==2.1.1
Project works perfectly on local/development server i.e python manage runserver works .
The secret key is set SECRET_KEY = os.environ.get('SECRET'), I have also tried hard coding SECRET_KEY = 'my-secret-key' but no difference.
I have os.environ.setdefault('DJANGO_SETTINGS_MODULE', '*foldername.settings.testing') correctly set in wsgi.py & manage.py
Other Settings
My Procfile for Heroku has web: gunicorn *foldername.wsgi:application --log-file -. I have a requirements and a runtime.txt files.
Error When I run $ heroku run python manage.py migrate
Running python manage.py migrate on ⬢ thawing-thicket-02648... up, run.2948 (Free)
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 224, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 36, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 14, in <module>
from django.db.migrations.autodetector import MigrationAutodetector
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/autodetector.py", line 11, in <module>
from django.db.migrations.questioner import MigrationQuestioner
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/questioner.py", line 9, in <module>
from .loader import MigrationLoader
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/loader.py", line 8, in <module>
from django.db.migrations.recorder import MigrationRecorder
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 9, in <module>
class MigrationRecorder:
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 22, in MigrationRecorder
class Migration(models.Model):
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/base.py", line 87, in __new__
app_config = apps.get_containing_app_config(module)
File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/registry.py", line 249, in get_containing_app_config
self.check_apps_ready()
File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/registry.py", line 131, in check_apps_ready
settings.INSTALLED_APPS
File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 57, in __getattr__
self._setup(name)
File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 126, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
Running $ heroku logs --tail produces
2020-01-29T15:56:40.652606+00:00 app[web.1]: self.reap_workers()
2020-01-29T15:56:40.652609+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2020-01-29T15:56:40.652893+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2020-01-29T15:56:40.652896+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2020-01-29T15:56:40.745655+00:00 heroku[web.1]: State changed from starting to crashed
2020-01-29T15:56:40.725433+00:00 heroku[web.1]: Process exited with status 1
2020-01-29T16:21:03.239311+00:00 app[api]: Starting process with command `python manage.py migrate` by user developers#email.com
2020-01-29T16:21:11.782005+00:00 heroku[run.2948]: State changed from starting to up
2020-01-29T16:21:11.639515+00:00 heroku[run.2948]: Awaiting client
2020-01-29T16:21:11.664869+00:00 heroku[run.2948]: Starting process with command `python manage.py migrate`
2020-01-29T16:21:16.264816+00:00 heroku[run.2948]: State changed from up to complete
2020-01-29T16:21:16.241764+00:00 heroku[run.2948]: Process exited with status 1
2020-01-29T16:23:33.250194+00:00 heroku[web.1]: State changed from crashed to starting
2020-01-29T16:23:39.991409+00:00 heroku[web.1]: Starting process with command `gunicorn foldername.wsgi --log-file -`
2020-01-29T16:23:42.075462+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [4] [INFO] Starting gunicorn 20.0.4
2020-01-29T16:23:42.076104+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [4] [INFO] Listening at: http://0.0.0.0:34607 (4)
2020-01-29T16:23:42.076210+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [4] [INFO] Using worker: sync
2020-01-29T16:23:42.080161+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [10] [INFO] Booting worker with pid: 10
2020-01-29T16:23:42.131810+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [11] [INFO] Booting worker with pid: 11
2020-01-29T16:23:42.302136+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [10] [ERROR] Exception in worker process
2020-01-29T16:23:42.302140+00:00 app[web.1]: Traceback (most recent call last):
2020-01-29T16:23:42.302160+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-01-29T16:23:42.302163+00:00 app[web.1]: worker.init_process()
2020-01-29T16:23:42.302165+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-01-29T16:23:42.302167+00:00 app[web.1]: self.load_wsgi()
2020-01-29T16:23:42.302169+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-01-29T16:23:42.302171+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-01-29T16:23:42.302173+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-01-29T16:23:42.302176+00:00 app[web.1]: self.callable = self.load()
2020-01-29T16:23:42.302178+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-01-29T16:23:42.302180+00:00 app[web.1]: return self.load_wsgiapp()
2020-01-29T16:23:42.302182+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-01-29T16:23:42.302184+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-01-29T16:23:42.302186+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-01-29T16:23:42.302188+00:00 app[web.1]: mod = importlib.import_module(module)
2020-01-29T16:23:42.302190+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-01-29T16:23:42.302193+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-01-29T16:23:42.302195+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-01-29T16:23:42.302197+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-01-29T16:23:42.302199+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-01-29T16:23:42.302201+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-01-29T16:23:42.302203+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-01-29T16:23:42.302205+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-01-29T16:23:42.302207+00:00 app[web.1]: File "/app/foldername/wsgi.py", line 15, in <module>
2020-01-29T16:23:42.302209+00:00 app[web.1]: application = get_wsgi_application()
2020-01-29T16:23:42.302211+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2020-01-29T16:23:42.302213+00:00 app[web.1]: django.setup(set_prefix=False)
2020-01-29T16:23:42.302215+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
2020-01-29T16:23:42.302217+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2020-01-29T16:23:42.302219+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 57, in __getattr__
2020-01-29T16:23:42.302221+00:00 app[web.1]: self._setup(name)
2020-01-29T16:23:42.302224+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 44, in _setup
2020-01-29T16:23:42.302226+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2020-01-29T16:23:42.302228+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 126, in __init__
2020-01-29T16:23:42.302230+00:00 app[web.1]: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
2020-01-29T16:23:42.302240+00:00 app[web.1]: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
2020-01-29T16:23:42.302620+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-01-29T16:23:42.322533+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [11] [ERROR] Exception in worker process
2020-01-29T16:23:42.322537+00:00 app[web.1]: Traceback (most recent call last):
2020-01-29T16:23:42.322539+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-01-29T16:23:42.322542+00:00 app[web.1]: worker.init_process()
2020-01-29T16:23:42.322544+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-01-29T16:23:42.322545+00:00 app[web.1]: self.load_wsgi()
2020-01-29T16:23:42.322547+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-01-29T16:23:42.322549+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-01-29T16:23:42.322552+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-01-29T16:23:42.322554+00:00 app[web.1]: self.callable = self.load()
2020-01-29T16:23:42.322556+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-01-29T16:23:42.322558+00:00 app[web.1]: return self.load_wsgiapp()
2020-01-29T16:23:42.322560+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-01-29T16:23:42.322562+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-01-29T16:23:42.322564+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-01-29T16:23:42.322566+00:00 app[web.1]: mod = importlib.import_module(module)
2020-01-29T16:23:42.322568+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-01-29T16:23:42.322570+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-01-29T16:23:42.322572+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-01-29T16:23:42.322574+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-01-29T16:23:42.322576+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-01-29T16:23:42.322578+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-01-29T16:23:42.322580+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-01-29T16:23:42.322582+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-01-29T16:23:42.322584+00:00 app[web.1]: File "/app/foldername/wsgi.py", line 15, in <module>
2020-01-29T16:23:42.322586+00:00 app[web.1]: application = get_wsgi_application()
2020-01-29T16:23:42.322588+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2020-01-29T16:23:42.322590+00:00 app[web.1]: django.setup(set_prefix=False)
2020-01-29T16:23:42.322592+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
2020-01-29T16:23:42.322594+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2020-01-29T16:23:42.322596+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 57, in __getattr__
2020-01-29T16:23:42.322598+00:00 app[web.1]: self._setup(name)
2020-01-29T16:23:42.322600+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 44, in _setup
2020-01-29T16:23:42.322602+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2020-01-29T16:23:42.322604+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 126, in __init__
2020-01-29T16:23:42.322606+00:00 app[web.1]: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
2020-01-29T16:23:42.322609+00:00 app[web.1]: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
2020-01-29T16:23:42.322958+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [11] [INFO] Worker exiting (pid: 11)
2020-01-29T16:23:42.449777+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [4] [INFO] Shutting down: Master
2020-01-29T16:23:42.469241+00:00 app[web.1]: [2020-01-29 16:23:42 +0000] [4] [INFO] Reason: Worker failed to boot.
2020-01-29T16:23:42.572344+00:00 heroku[web.1]: State changed from starting to crashed
2020-01-29T16:23:42.557638+00:00 heroku[web.1]: Process exited with status 3
Normal $ python manage.py migrate without heroku run part does the migrations but app still won't start and error trace back from $ heroku logs --tail still present and the same
See my folder structure & wsgi.py
See my manage.py
Settings just to show secret key is in
Long time has passed but if I had seen this I would have saved a couple hours. I had the same issue as I had forgot to set the SECRET_KEY variable in the Heroku config vars.