Heroku Application Error with Flask Socket-IO - flask

The app is perfectly working on local but on heroku server it returns Application Error. I suspect the problem might be on Procfile, when I changed it to "web: gunicorn eventlet -w 1 app:app", from "web: gunicorn app:app" it stopped working, I'm new on socketIO and flask, I've tried everything I saw on the internet to put on Procfile that works with socketIO but nothing worked.
Please if anyone knows why this is happening please help me.
This is my requirements.txt file:
bidict==0.22.0
brotlipy==0.7.0
certifi==2021.10.8
click==8.1.3
dnspython==2.2.1
eventlet==0.33.1
Flask==2.1.3
Flask-SocketIO==5.2.0
Flask-SQLAlchemy==2.5.1
Flask-WTF==1.0.1
gevent==21.12.0
gevent-websocket==0.10.1
greenlet==1.1.2
gunicorn==20.1.0
importlib-metadata==4.12.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.1
psycopg2==2.9.3
pycosat==0.6.3
python-engineio==4.3.3
python-socketio==5.7.1
SQLAlchemy==1.4.39
Werkzeug==2.1.2
wincertstore==0.2
WTForms==3.0.1
zipp==3.8.1
zope.event==4.5.0
zope.interface==5.4.0
this is the heroku logs:
2022-08-05T15:16:18.022704+00:00 app[web.1]:
2022-08-05T15:16:18.022716+00:00 app[web.1]: Error: class uri 'eventlet' invalid or not found:
2022-08-05T15:16:18.022716+00:00 app[web.1]:
2022-08-05T15:16:18.022717+00:00 app[web.1]: [Traceback (most recent call last):
2022-08-05T15:16:18.022717+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/util.py", line 99, in load_class
2022-08-05T15:16:18.022718+00:00 app[web.1]: mod = importlib.import_module('.'.join(components))
2022-08-05T15:16:18.022718+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-08-05T15:16:18.022718+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-08-05T15:16:18.022719+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2022-08-05T15:16:18.022719+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2022-08-05T15:16:18.022720+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
2022-08-05T15:16:18.022720+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2022-08-05T15:16:18.022720+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2022-08-05T15:16:18.022721+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2022-08-05T15:16:18.022721+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/workers/geventlet.py", line 20, in <module>
2022-08-05T15:16:18.022721+00:00 app[web.1]: from eventlet.wsgi import ALREADY_HANDLED as EVENTLET_ALREADY_HANDLED
2022-08-05T15:16:18.022722+00:00 app[web.1]: ImportError: cannot import name 'ALREADY_HANDLED' from 'eventlet.wsgi' (/app/.heroku/python/lib/python3.10/site-packages/eventlet/wsgi.py)
2022-08-05T15:16:18.022722+00:00 app[web.1]: ]
2022-08-05T15:16:18.022722+00:00 app[web.1]:
2022-08-05T15:16:18.246442+00:00 heroku[web.1]: Process exited with status 1
2022-08-05T15:16:18.357952+00:00 heroku[web.1]: State changed from starting to crashed
2022-08-05T15:16:18.374380+00:00 heroku[web.1]: State changed from crashed to starting
2022-08-05T15:16:23.365045+00:00 heroku[web.1]: Starting process with command `gunicorn -k eventlet -w 1 app:app`
2022-08-05T15:16:24.399378+00:00 app[web.1]:
2022-08-05T15:16:24.399392+00:00 app[web.1]: Error: class uri 'eventlet' invalid or not found:
2022-08-05T15:16:24.399392+00:00 app[web.1]:
2022-08-05T15:16:24.399393+00:00 app[web.1]: [Traceback (most recent call last):
2022-08-05T15:16:24.399393+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/util.py", line 99, in load_class
2022-08-05T15:16:24.399393+00:00 app[web.1]: mod = importlib.import_module('.'.join(components))
2022-08-05T15:16:24.399394+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-08-05T15:16:24.399394+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-08-05T15:16:24.399394+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2022-08-05T15:16:24.399395+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2022-08-05T15:16:24.399395+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
2022-08-05T15:16:24.399395+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2022-08-05T15:16:24.399396+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2022-08-05T15:16:24.399396+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2022-08-05T15:16:24.399396+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/workers/geventlet.py", line 20, in <module>
2022-08-05T15:16:24.399397+00:00 app[web.1]: from eventlet.wsgi import ALREADY_HANDLED as EVENTLET_ALREADY_HANDLED
2022-08-05T15:16:24.399397+00:00 app[web.1]: ImportError: cannot import name 'ALREADY_HANDLED' from 'eventlet.wsgi' (/app/.heroku/python/lib/python3.10/site-packages/eventlet/wsgi.py)
2022-08-05T15:16:24.399398+00:00 app[web.1]: ]
2022-08-05T15:16:24.399402+00:00 app[web.1]:
2022-08-05T15:16:24.550505+00:00 heroku[web.1]: Process exited with status 1
2022-08-05T15:16:24.671364+00:00 heroku[web.1]: State changed from starting to crashed
2022-08-05T15:31:37.077623+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/session" host=cheesecake142.herokuapp.com request_id=95dbcb95-8af7-42d6-8979-10d78af79447 fwd="120.29.69.149" dyno= connect= service= status=503 bytes= protocol=https
2022-08-05T15:31:37.460979+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cheesecake142.herokuapp.com request_id=0ca459b8-538a-47f9-a4b4-296e21540db8 fwd="120.29.69.149" dyno= connect=
service= status=503 bytes= protocol=https
I'm willing to provide additional details about this problem if needed.

So I had this exact issue myself just now, what worked for me in terms of getting rid of errors related to eventlet was specifying the python version (apparently python 3.2.0 is incompatible with the downgraded eventlet version, read eventlet issue 687). I still have other issues but they're unrelated so this might work for you:
create a runtime.txt file in root directory
in the file add python-3.9.13
Just to clarify my package versions:
bidict==0.22.0
CacheControl==0.12.11
cachetools==5.2.0
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==2.1.0
click==8.1.3
colorama==0.4.5
dnspython==1.16.0
eventlet==0.30.2
firebase-admin==5.2.0
Flask==2.2.1
Flask-SocketIO==5.2.0
gevent==21.12.0
gevent-websocket==0.10.1
google-api-core==2.8.2
google-api-python-client==2.55.0
google-auth==2.10.0
google-auth-httplib2==0.1.0
google-cloud-core==2.3.2
google-cloud-firestore==2.6.0
google-cloud-storage==2.5.0
google-crc32c==1.3.0
google-resumable-media==2.3.3
googleapis-common-protos==1.56.4
greenlet==1.1.2
grpcio==1.47.0
grpcio-status==1.47.0
gunicorn==20.1.0
httplib2==0.20.4
idna==3.3
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.1
msgpack==1.0.4
proto-plus==1.20.6
protobuf==3.20.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
pyparsing==3.0.9
python-decouple==3.6
python-dotenv==0.20.0
python-engineio==4.3.4
python-socketio==5.7.1
requests==2.28.1
rsa==4.9
six==1.16.0
uritemplate==4.1.1
urllib3==1.26.11
Werkzeug==2.2.1
zope.event==4.5.0
zope.interface==5.4.0
My Procfile:
web: gunicorn --worker-class eventlet -w 1 application:app
Hope this works!
Edit:
Forgot to clarify that dnspython has to be 1.16.0, your error in regards to that is due to the version not being lower than 2.0.0 - i still however after downgrading that to 1.16.0 got different errors which went away with the solution above

Try this:
pip install gunicorn==20.1.0 eventlet==0.30.2

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.

Gettting the errror of my application can be served in heroku for django app

I am getting an error while deploying app on heroku
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
Everything is working perfectly fine on heroku local
here are some of settings that I did
ALLOWED_HOSTS = ['0.0.0.0']
and here is Procfile
web: python manage.py runserver 0.0.0.0:$PORT
Here are my heroku logs
2022-07-10T16:25:15.788202+00:00 app[web.1]: The above exception was the direct cause of the following exception:
2022-07-10T16:25:15.788202+00:00 app[web.1]:
2022-07-10T16:25:15.788210+00:00 app[web.1]: Traceback (most recent call last):
2022-07-10T16:25:15.788218+00:00 app[web.1]: File "/app/manage.py", line 22, in <module>
2022-07-10T16:25:15.788278+00:00 app[web.1]: main()
2022-07-10T16:25:15.788285+00:00 app[web.1]: File "/app/manage.py", line 18, in main
2022-07-10T16:25:15.788341+00:00 app[web.1]: execute_from_command_line(sys.argv)
2022-07-10T16:25:15.788349+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
2022-07-10T16:25:15.788475+00:00 app[web.1]: utility.execute()
2022-07-10T16:25:15.788483+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
2022-07-10T16:25:15.788599+00:00 app[web.1]: self.fetch_command(subcommand).run_from_argv(self.argv)
2022-07-10T16:25:15.788606+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv
2022-07-10T16:25:15.788717+00:00 app[web.1]: self.execute(*args, **cmd_options)
2022-07-10T16:25:15.788725+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 74, in execute
2022-07-10T16:25:15.788789+00:00 app[web.1]: super().execute(*args, **options)
2022-07-10T16:25:15.788797+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 460, in execute
2022-07-10T16:25:15.788909+00:00 app[web.1]: output = self.handle(*args, **options)
2022-07-10T16:25:15.788916+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 81, in handle
2022-07-10T16:25:15.788980+00:00 app[web.1]: if not settings.DEBUG and not settings.ALLOWED_HOSTS:
2022-07-10T16:25:15.788987+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/conf/__init__.py", line 87, in __getattr__
2022-07-10T16:25:15.789055+00:00 app[web.1]: self._setup(name)
2022-07-10T16:25:15.789062+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/conf/__init__.py", line 74, in _setup
2022-07-10T16:25:15.789135+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2022-07-10T16:25:15.789142+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/conf/__init__.py", line 183, in __init__
2022-07-10T16:25:15.789219+00:00 app[web.1]: mod = importlib.import_module(self.SETTINGS_MODULE)
2022-07-10T16:25:15.789226+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-07-10T16:25:15.789298+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-07-10T16:25:15.789305+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2022-07-10T16:25:15.789371+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2022-07-10T16:25:15.789411+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
2022-07-10T16:25:15.789450+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2022-07-10T16:25:15.789489+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2022-07-10T16:25:15.789535+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2022-07-10T16:25:15.789574+00:00 app[web.1]: File "/app/authentication/settings.py", line 98, in <module>
2022-07-10T16:25:15.789645+00:00 app[web.1]: 'NAME': env('DATABASE_NAME'),
2022-07-10T16:25:15.789652+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/environ/environ.py", line 197, in __call__
2022-07-10T16:25:15.789736+00:00 app[web.1]: return self.get_value(
2022-07-10T16:25:15.789743+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/environ/environ.py", line 407, in get_value
2022-07-10T16:25:15.789852+00:00 app[web.1]: raise ImproperlyConfigured(error_msg) from exc
2022-07-10T16:25:15.789898+00:00 app[web.1]: django.core.exceptions.ImproperlyConfigured: Set the DATABASE_NAME environment variable
2022-07-10T16:25:15.946054+00:00 heroku[web.1]: Process exited with status 1
2022-07-10T16:25:16.065755+00:00 heroku[web.1]: State changed from starting to crashed
2022-07-10T16:25:16.070616+00:00 heroku[web.1]: State changed from crashed to starting
2022-07-10T16:25:20.000000+00:00 app[api]: Build succeeded
2022-07-10T16:25:20.067039+00:00 heroku[web.1]: Starting process with command `python manage.py runserver 0.0.0.0:37161`
2022-07-10T16:25:21.237371+00:00 app[web.1]: Traceback (most recent call last):
2022-07-10T16:25:21.237385+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/environ/environ.py", line 403, in get_value
2022-07-10T16:25:21.237547+00:00 app[web.1]: value = self.ENVIRON[var_name]
2022-07-10T16:25:21.237555+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/os.py", line 679, in __getitem__
2022-07-10T16:25:21.237770+00:00 app[web.1]: raise KeyError(key) from None
2022-07-10T16:25:21.237797+00:00 app[web.1]: KeyError: 'DATABASE_NAME'
2022-07-10T16:25:21.237799+00:00 app[web.1]:
2022-07-10T16:25:21.237799+00:00 app[web.1]: The above exception was the direct cause of the following exception:
2022-07-10T16:25:21.237799+00:00 app[web.1]:
2022-07-10T16:25:21.237802+00:00 app[web.1]: Traceback (most recent call last):
2022-07-10T16:25:21.237811+00:00 app[web.1]: File "/app/manage.py", line 22, in <module>
2022-07-10T16:25:21.237879+00:00 app[web.1]: main()
2022-07-10T16:25:21.237881+00:00 app[web.1]: File "/app/manage.py", line 18, in main
2022-07-10T16:25:21.237946+00:00 app[web.1]: execute_from_command_line(sys.argv)
2022-07-10T16:25:21.237953+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
2022-07-10T16:25:21.238093+00:00 app[web.1]: utility.execute()
2022-07-10T16:25:21.238101+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
2022-07-10T16:25:21.238231+00:00 app[web.1]: self.fetch_command(subcommand).run_from_argv(self.argv)
2022-07-10T16:25:21.238240+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv
2022-07-10T16:25:21.238392+00:00 app[web.1]: self.execute(*args, **cmd_options)
2022-07-10T16:25:21.238408+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 74, in execute
2022-07-10T16:25:21.238490+00:00 app[web.1]: super().execute(*args, **options)
2022-07-10T16:25:21.238492+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 460, in execute
2022-07-10T16:25:21.238623+00:00 app[web.1]: output = self.handle(*args, **options)
2022-07-10T16:25:21.238631+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 81, in handle
2022-07-10T16:25:21.238705+00:00 app[web.1]: if not settings.DEBUG and not settings.ALLOWED_HOSTS:
2022-07-10T16:25:21.238713+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/conf/__init__.py", line 87, in __getattr__
2022-07-10T16:25:21.238787+00:00 app[web.1]: self._setup(name)
2022-07-10T16:25:21.238795+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/conf/__init__.py", line 74, in _setup
2022-07-10T16:25:21.238865+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2022-07-10T16:25:21.238873+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/django/conf/__init__.py", line 183, in __init__
2022-07-10T16:25:21.238981+00:00 app[web.1]: mod = importlib.import_module(self.SETTINGS_MODULE)
2022-07-10T16:25:21.238983+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-07-10T16:25:21.239083+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-07-10T16:25:21.239094+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2022-07-10T16:25:21.239164+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2022-07-10T16:25:21.239210+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
2022-07-10T16:25:21.239272+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2022-07-10T16:25:21.239314+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2022-07-10T16:25:21.239367+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2022-07-10T16:25:21.239438+00:00 app[web.1]: File "/app/authentication/settings.py", line 98, in <module>
2022-07-10T16:25:21.239526+00:00 app[web.1]: 'NAME': env('DATABASE_NAME'),
2022-07-10T16:25:21.239528+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/environ/environ.py", line 197, in __call__
2022-07-10T16:25:21.239624+00:00 app[web.1]: return self.get_value(
2022-07-10T16:25:21.239633+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/environ/environ.py", line 407, in get_value
2022-07-10T16:25:21.239756+00:00 app[web.1]: raise ImproperlyConfigured(error_msg) from exc
2022-07-10T16:25:21.239777+00:00 app[web.1]: django.core.exceptions.ImproperlyConfigured: Set the DATABASE_NAME environment variable
2022-07-10T16:25:21.387335+00:00 heroku[web.1]: Process exited with status 1
2022-07-10T16:25:21.433687+00:00 heroku[web.1]: State changed from starting to crashed
2022-07-10T16:25:22.244946+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=noorauth.herokuapp.com request_id=955f478f-323f-4a40-8fdc-38028f4f40b8 fwd="103.184.0.73" dyno= connect= service= status=503 bytes= protocol=https
2022-07-10T16:25:22.534127+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=noorauth.herokuapp.com request_id=7f6694f9-8224-46be-b742-c20078077222 fwd="103.184.0.73" dyno= connect= service= status=503 bytes= protocol=https
2022-07-10T16:26:01.095161+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=noorauth.herokuapp.com request_id=542f9404-c45a-4264-832f-f0e4db52408c fwd="103.184.0.73" dyno= connect= service= status=503 bytes= protocol=https
2022-07-10T16:26:01.670778+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=noorauth.herokuapp.com request_id=a2e698a4-2547-4577-bc07-9b2d22293de5 fwd="103.184.0.73" dyno= connect= service= status=503 bytes= protocol=https
2022-07-10T16:29:59.391310+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=noorauth.herokuapp.com request_id=27902494-85e4-4f36-bbaa-89ae7e2895c2 fwd="103.184.0.73" dyno= connect= service= status=503 bytes= protocol=http
2022-07-10T16:30:00.717408+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=noorauth.herokuapp.com request_id=17f3bab1-2105-4677-8b94-3c2a05456c04 fwd="103.184.0.73" dyno= connect= service= status=503 bytes= protocol=http
The errors tells about the database name and everything that I have stored in .env file, what should I do, I can;t find ay help regarding the databses when deploying the app.
Your traceback is telling you that the 'DATABASE_NAME' environment variable has not been set, you can set that within your Heroku configuration.
https://devcenter.heroku.com/articles/config-vars
Another point is that your allowed hosts only has '0.0.0.0', you will need to include your Heroku app URL in there as well, or your custom URL if you are using a DNS provider.

deploy django-app to heroku - Application error

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.

No module named 'XXXXXXXX' in Django Heroku deployment

I am looking to make my first HEROKU deployment of a Django application, but I get the following error:
Traceback (most recent call last)
File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/app/.heroku/python/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[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 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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
at=error code=H10 desc="App crashed" method=GET path="/" host=temporalworld.herokuapp.com request_id=facb0a69-8362-4cea-99b1-152866e0487b fwd="146.112.251.213" dyno= connect= service= status=503 bytes= protocol=http
looks like i am missing a module. Is anybody familiar with this please?
0
I spent the day on it, and all i had to do was changing:
web: gunicorn core.wsgi --log-file=-
web: gunicorn my_app.wsgi
to
web: gunicorn core.wsgi --log-file=-
Basically removing the second line, and it worked.

I am trying to deploy my Django project to Heroku but an error regarding my SECRET_KEY keeps appearing

I am deploying an e-commerce project to Heroku and seem to be running into constant issues and errors.
My latest error surrounds the below traceback:
2019-11-11T13:35:34.080363+00:00 heroku[web.1]: State changed from crashed to starting
2019-11-11T13:35:40.020789+00:00 heroku[web.1]: Starting process with command `gunicorn fancyfetish.wsgi:application --preload --workers 1`
2019-11-11T13:35:42.589255+00:00 heroku[web.1]: State changed from starting to crashed
2019-11-11T13:35:42.460008+00:00 app[web.1]: Traceback (most recent call last):
2019-11-11T13:35:42.460049+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 11, in <module>
2019-11-11T13:35:42.460136+00:00 app[web.1]: sys.exit(run())
2019-11-11T13:35:42.460148+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
2019-11-11T13:35:42.460262+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2019-11-11T13:35:42.460273+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 219, in run
2019-11-11T13:35:42.460434+00:00 app[web.1]: super().run()
2019-11-11T13:35:42.460438+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
2019-11-11T13:35:42.460565+00:00 app[web.1]: Arbiter(self).run()
2019-11-11T13:35:42.460571+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 58, in __init__
2019-11-11T13:35:42.460689+00:00 app[web.1]: self.setup(app)
2019-11-11T13:35:42.460692+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 118, in setup
2019-11-11T13:35:42.460823+00:00 app[web.1]: self.app.wsgi()
2019-11-11T13:35:42.460827+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2019-11-11T13:35:42.460978+00:00 app[web.1]: self.callable = self.load()
2019-11-11T13:35:42.460981+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2019-11-11T13:35:42.461083+00:00 app[web.1]: return self.load_wsgiapp()
2019-11-11T13:35:42.461087+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2019-11-11T13:35:42.461204+00:00 app[web.1]: return util.import_app(self.app_uri)
2019-11-11T13:35:42.461207+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 331, in import_app
2019-11-11T13:35:42.461388+00:00 app[web.1]: mod = importlib.import_module(module)
2019-11-11T13:35:42.461392+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2019-11-11T13:35:42.461529+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2019-11-11T13:35:42.461542+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2019-11-11T13:35:42.461664+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2019-11-11T13:35:42.461737+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2019-11-11T13:35:42.461813+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2019-11-11T13:35:42.461888+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2019-11-11T13:35:42.461983+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2019-11-11T13:35:42.462061+00:00 app[web.1]: File "/app/fancyfetish/wsgi.py", line 17, in <module>
2019-11-11T13:35:42.462171+00:00 app[web.1]: application = get_wsgi_application()
2019-11-11T13:35:42.462176+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2019-11-11T13:35:42.462279+00:00 app[web.1]: django.setup(set_prefix=False)
2019-11-11T13:35:42.462298+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
2019-11-11T13:35:42.462381+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2019-11-11T13:35:42.462385+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in __getattr__
2019-11-11T13:35:42.462516+00:00 app[web.1]: self._setup(name)
2019-11-11T13:35:42.462519+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 66, in _setup
2019-11-11T13:35:42.462637+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2019-11-11T13:35:42.462639+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 176, in __init__
2019-11-11T13:35:42.462783+00:00 app[web.1]: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
2019-11-11T13:35:42.462808+00:00 app[web.1]: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
2019-11-11T13:35:42.575764+00:00 heroku[web.1]: Process exited with status 1
2019-11-11T13:35:47.000000+00:00 app[api]: Build succeeded
2019-11-11T13:36:25.358883+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fancyfetish.herokuapp.com request_id=4f0e5e77-53c9-443a-8647-c5b88a01ae17 fwd="81.100.164.113" dyno= connect= service= status=503 bytes= protocol=https
2019-11-11T13:36:25.563374+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fancyfetish.herokuapp.com request_id=3828cca1-593c-4785-9c82-6b614c233dea fwd="81.100.164.113" dyno= connect= service= status=503 bytes= protocol=https
I have got three settings files under the directory settings, outlined below:
|____settings
| |______init__.py
| |____development.py
| |______pycache__
| | |____production.cpython-37.pyc
| | |____base.cpython-37.pyc
| | |____development.cpython-37.pyc
| | |______init__.cpython-37.pyc
| |____base.py
| |____production.py
|______init__.py
|______pycache__
| |____settings.cpython-37.pyc
| |____wsgi.cpython-37.pyc
| |____urls.cpython-37.pyc
| |______init__.cpython-37.pyc
|____urls.py
|____wsgi.py
All three of my settings files (base.py, development.py and production.py) have a SECRET_KEY defined so I am not sure why this error keeps appearing.
The SECRET_KEY is randomly generated. Is this to do with gunicorn?
My wsgi file looks like this:
import os
from django.core.wsgi import get_wsgi_application
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fancyfetish.settings')
application = get_wsgi_application()
(I am unsure if I even need to import from django.core.wsgi but this seemed to be someone elses solution, it didn't work for me)
My Procfile looks like this:
web: gunicorn fancyfetish.wsgi:application --preload --workers 1
My requirements.txt file looks like this:
beautifulsoup4==4.8.1
Django==2.2.6
django-appconf==1.0.3
django-bootstrap4==1.0.1
django-compressor==2.3
django-libsass==0.7
django-sass-processor==0.7.4
gunicorn==20.0.0
libsass==0.19.3
mysql-connector-python==8.0.18
Pillow==6.2.1
protobuf==3.10.0
pytz==2019.3
rcssmin==1.0.6
rjsmin==1.1.0
six==1.12.0
soupsieve==1.9.5
sqlparse==0.3.0
Is anyone able to see whay I am doing so wrong? Is it a compatibility issue between versions?
Try changing this line in your wsgi file:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fancyfetish.settings')
for this:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fancyfetish.settings.development') # or .production