M
M
MalikDeveloper20772020-07-30 20:21:51
Django
MalikDeveloper2077, 2020-07-30 20:21:51

Gunicorn + Django. ModuleNotFoundError: module named diasmart (my project) not found?

This is how the
iOgSw.png

diasmart file structure looks like - this is the project folder where settings.py, wsgi.py, etc. are stored

. I have a bash file start_gunicorn.sh

#!/bin/bash
source /root/DiaStore/env/bin/activate  # виртуальное окружение
exec gunicorn  -c "/root/DiaStore/src/gunicorn_config.py" diasmart.wsgi


After that I have a supervisor config which starts gunicorn using start_gunicorn.sh
But I got an error from start_gunicorn.py:
self.callable = self.load()
  File "/root/DiaStore/env/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
    return self.load_wsgiapp()
  File "/root/DiaStore/env/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/root/DiaStore/env/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app
    mod = importlib.import_module(module)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'diasmart'
[2020-07-30 16:50:09 +0000] [109587] [INFO] Worker exiting (pid: 109587)
[2020-07-30 16:50:09 +0000] [109585] [INFO] Shutting down: Master
[2020-07-30 16:50:09 +0000] [109585] [INFO] Reason: Worker failed to boot.


All other things except launching the gunicorn are correct, by experimenting, I think that the error lies in start_gunicorn.sh, namely the wrong path to wsgi (diasmart.wsgi). I moved this script to different directories and ran from them, but always the same error that the specified module (diasmart in this case) is missing.

How can this be fixed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-07-31
@dimonchik2013

you need to fix it
, look at the logs that that worker does not work,
but with the sh file, in general, something is muddy, through the config settings you need to

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question