ModuleNotFoundError: No module named 'django_app' with heroku deployement

Hey mentors and senior devs I am now on this issue 5-7 hours trying to solve it, This issue happens during the deployment of my app on digital oceans apps and these are logs that Heroku sent please help me figure it out

2022-10-03T10:37:01.047248352Z [2022-10-03 10:37:01 +0000] [1] [INFO] Starting gunicorn 20.1.0
2022-10-03T10:37:01.048342704Z [2022-10-03 10:37:01 +0000] [1] [INFO] Listening at: 
http://0.0.0.0:8080 (1)
2022-10-03T10:37:01.048420287Z [2022-10-03 10:37:01 +0000] [1] [INFO] Using worker: sync
2022-10-03T10:37:01.105225067Z [2022-10-03 10:37:01 +0000] [16] [INFO] Booting worker with 
pid: 16
2022-10-03T10:37:01.121367774Z [2022-10-03 10:37:01 +0000] [16] [ERROR] Exception in worker 
process
2022-10-03T10:37:01.121405181Z Traceback (most recent call last):
2022-10-03T10:37:01.121410503Z   File "/workspace/.heroku/python/lib/python3.10/site- 
packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-10-03T10:37:01.121414404Z     worker.init_process()
2022-10-03T10:37:01.121419137Z   File "/workspace/.heroku/python/lib/python3.10/site-``` 
packages/gunicorn/workers/base.py", line 134, in init_process
2022-10-03T10:37:01.121423724Z     self.load_wsgi()
2022-10-03T10:37:01.121428153Z   File "/workspace/.heroku/python/lib/python3.10/site- 
packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-10-03T10:37:01.121431187Z     self.wsgi = self.app.wsgi()
2022-10-03T10:37:01.121434180Z   File "/workspace/.heroku/python/lib/python3.10/site- 
packages/gunicorn/app/base.py", line 67, in wsgi
2022-10-03T10:37:01.121438157Z     self.callable = self.load()
2022-10-03T10:37:01.121441663Z   File "/workspace/.heroku/python/lib/python3.10/site- 
packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-10-03T10:37:01.121462270Z     return self.load_wsgiapp()
2022-10-03T10:37:01.121465690Z   File "/workspace/.heroku/python/lib/python3.10/site- 
packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-10-03T10:37:01.121469061Z     return util.import_app(self.app_uri)
2022-10-03T10:37:01.121472387Z   File "/workspace/.heroku/python/lib/python3.10/site- 
packages/gunicorn/util.py", line 359, in import_app
2022-10-03T10:37:01.121475619Z     mod = importlib.import_module(module)
2022-10-03T10:37:01.121482753Z   File 
"/workspace/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-10-03T10:37:01.121486027Z     return _bootstrap._gcd_import(name[level:], package, level)
2022-10-03T10:37:01.121490349Z   File "<frozen importlib._bootstrap>", line 1050, in 
_gcd_import
2022-10-03T10:37:01.121493850Z   File "<frozen importlib._bootstrap>", line 1027, in 
_find_and_load
2022-10-03T10:37:01.121497304Z   File "<frozen importlib._bootstrap>", line 992, in 

_find_and_load_unlocked 2022-10-03T10:37:01.121501773Z File "", line 241, in _call_with_frames_removed 2022-10-03T10:37:01.121505268Z File "", line 1050, in _gcd_import 2022-10-03T10:37:01.121508644Z File "", line 1027, in _find_and_load 2022-10-03T10:37:01.121511905Z File "", line 1004, in _find_and_load_unlocked 2022-10-03T10:37:01.121515248Z ModuleNotFoundError: No module named 'django_app' 2022-10-03T10:37:01.121731498Z [2022-10-03 10:37:01 +0000] [16] [INFO] Worker exiting (pid: 16) 2022-10-03T10:37:01.207224069Z [2022-10-03 10:37:01 +0000] [1] [INFO] Shutting down: Master 2022-10-03T10:37:01.207265202Z [2022-10-03 10:37:01 +0000] [1] [INFO] Reason: Worker failed to boot. 2022-10-03T10:37:04.348012028Z [2022-10-03 10:37:04 +0000] [1] [INFO] Starting gunicorn 20.1.0 2022-10-03T10:37:04.349215146Z [2022-10-03 10:37:04 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1) 2022-10-03T10:37:04.349332842Z [2022-10-03 10:37:04 +0000] [1] [INFO] Using worker: sync 2022-10-03T10:37:04.391853564Z [2022-10-03 10:37:04 +0000] [16] [INFO] Booting worker with pid: 16 2022-10-03T10:37:04.406015762Z [2022-10-03 10:37:04 +0000] [16] [ERROR] Exception in worker process 2022-10-03T10:37:04.406048084Z Traceback (most recent call last): 2022-10-03T10:37:04.406055314Z File "/workspace/.heroku/python/lib/python3.10/site- packages/gunicorn/arbiter.py", line 589, in spawn_worker 2022-10-03T10:37:04.406060597Z worker.init_process() 2022-10-03T10:37:04.406066330Z File "/workspace/.heroku/python/lib/python3.10/site- packages/gunicorn/workers/base.py", line 134, in init_process 2022-10-03T10:37:04.406070425Z self.load_wsgi() 2022-10-03T10:37:04.406073524Z File "/workspace/.heroku/python/lib/python3.10/site- packages/gunicorn/workers/base.py", line 146, in load_wsgi 2022-10-03T10:37:04.406075830Z self.wsgi = self.app.wsgi() 2022-10-03T10:37:04.406078174Z File "/workspace/.heroku/python/lib/python3.10/site- packages/gunicorn/app/base.py", line 67, in wsgi 2022-10-03T10:37:04.406081378Z self.callable = self.load() 2022-10-03T10:37:04.406083592Z File "/workspace/.heroku/python/lib/python3.10/site- packages/gunicorn/app/wsgiapp.py", line 58, in load 2022-10-03T10:37:04.406085923Z return self.load_wsgiapp() 2022-10-03T10:37:04.406089029Z File "/workspace/.heroku/python/lib/python3.10/site- packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp 2022-10-03T10:37:04.406091677Z return util.import_app(self.app_uri) 2022-10-03T10:37:04.406093958Z File "/workspace/.heroku/python/lib/python3.10/site- packages/gunicorn/util.py", line 359, in import_app 2022-10-03T10:37:04.406096392Z mod = importlib.import_module(module) 2022-10-03T10:37:04.406101142Z File "/workspace/.heroku/python/lib/python3.10/importlib/init.py", line 126, in import_module 2022-10-03T10:37:04.406103341Z return _bootstrap._gcd_import(name[level:], package, level) 2022-10-03T10:37:04.406105924Z File "", line 1050, in _gcd_import 2022-10-03T10:37:04.406108164Z File "", line 1027, in _find_and_load 2022-10-03T10:37:04.406110635Z File "", line 992, in _find_and_load_unlocked 2022-10-03T10:37:04.406113766Z File "", line 241, in _call_with_frames_removed 2022-10-03T10:37:04.406116173Z File "", line 1050, in _gcd_import 2022-10-03T10:37:04.406118254Z File "", line 1027, in _find_and_load 2022-10-03T10:37:04.406120822Z File "", line 1004, in _find_and_load_unlocked 2022-10-03T10:37:04.406122832Z ModuleNotFoundError: No module named 'django_app' 2022-10-03T10:37:04.406270392Z [2022-10-03 10:37:04 +0000] [16] [INFO] Worker exiting (pid: 16) 2022-10-03T10:37:04.482169771Z [2022-10-03 10:37:04 +0000] [1] [INFO] Shutting down: Master 2022-10-03T10:37:04.482261239Z [2022-10-03 10:37:04 +0000] [1] [INFO] Reason: Worker failed to boot.


in my requirements.txt

    asgiref==3.4.1
beautifulsoup4==4.11.1
binary==1.0.0
dj-database-url==1.0.0
Django==3.2.15
django-bootstrap-v5==1.0.11
django-crispy-forms==1.13.0
django-heroku==0.3.1
django-request==1.6.1
gunicorn==20.1.0
importlib-metadata==4.8.3
Pillow==8.4.0
psycopg2==2.9.3
psycopg2-binary==2.9.3
python-dateutil==2.8.2
pytz==2022.2.1
six==1.16.0
soupsieve==2.3.2.post1
sqlparse==0.4.2
typing-extensions==4.1.1
whitenoise==5.3.0
zipp==3.6.0

You got module not found error because you have not added your app in installed apps in settings file.

To add do the following:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'accounts',
    'users',
    'django_app', #added here
    'blog',
    'memberships',
    'dashboard',
    'crispy_forms',
    'bootstrap5',

]

In the run command within Digital Ocean's settings, you need to change django_app in gunicorn --worker-tmp-dir /dev/shm django_app.wsgi (from the Digital Ocean tutorial) to point to whichever app your Django app's wsgi.py file is in.

Back to Top