2

I would like to get some ideas about the error that I am getting. I have searched now but I couldn't get anything. I checked other resources to compare the my Procfile, and it seems that I have the correct format.

Procfile

web: gunicorn animals.wsgi:application --log-file - --log-level debug

Error I am getting:

2018-01-27T10:34:15.354613+00:00 app[web.1]: [2018-01-27 10:34:15 +0000] [4] [INFO] Starting gunicorn 19.7.1
    2018-01-27T10:34:15.355559+00:00 app[web.1]: [2018-01-27 10:34:15 +0000] [4] [DEBUG] Arbiter booted
    2018-01-27T10:34:15.361083+00:00 app[web.1]: [2018-01-27 10:34:15 +0000] [8] [INFO] Booting worker with pid: 8
    2018-01-27T10:34:15.367431+00:00 app[web.1]: ModuleNotFoundError: No module named 'animals.wsgi'
    2018-01-27T10:34:15.354290+00:00 app[web.1]:   keyfile: None
    2018-01-27T10:34:15.354294+00:00 app[web.1]:   cert_reqs: 0
    2018-01-27T10:34:15.354299+00:00 app[web.1]:   do_handshake_on_connect: False
    2018-01-27T10:34:15.367419+00:00 app[web.1]:     return self.load_wsgiapp()
    2018-01-27T10:34:15.367424+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 352, in import_app
    2018-01-27T10:34:15.354287+00:00 app[web.1]:   proxy_protocol: False
    2018-01-27T10:34:15.367425+00:00 app[web.1]:     __import__(module)
    2018-01-27T10:34:15.367413+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
    2018-01-27T10:34:15.354300+00:00 app[web.1]:   ciphers: TLSv1
    2018-01-27T10:34:15.355880+00:00 app[web.1]: [2018-01-27 10:34:15 +0000] [4] [INFO] Using worker: sync
    2018-01-27T10:34:15.367412+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
    2018-01-27T10:34:15.367601+00:00 app[web.1]: [2018-01-27 10:34:15 +0000] [8] [INFO] Worker exiting (pid: 8)
    2018-01-27T10:34:15.410294+00:00 app[web.1]: [2018-01-27 10:34:15 +0000] [4] [INFO] Reason: Worker failed to boot.
    2018-01-27T10:34:15.410106+00:00 app[web.1]: [2018-01-27 10:34:15 +0000] [4] [INFO] Shutting down: Master

Any suggestions?

tango ward
  • 307
  • 1
  • 4
  • 18
  • I had the same issue. This solved it: https://stackoverflow.com/questions/47616586/gunicorn-django-importerror-no-module-named-application-wsgi – Dylan May 22 '18 at 22:23

2 Answers2

1

Extending answer from here I tried my WSGI path to gunicorn myproject.myproject.wsgi:application --log-file -and yes error changed now it says ImportError: No module named myproject.settings. To solve this I changed my wsgi file.

FROM:

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')

TO:

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.myproject.settings')

It woked like a charm for me!

Muhammad Haseeb
  • 634
  • 5
  • 20
-1

I was getting the same error by making the following changes, I was able to resolve it.

  1. The Procfile should be in the myproject directory along with manage.py and .git but not in myproject/myproject.

enter image description here

  1. The Procfile should have this code web: gunicorn myproject.wsgi

  2. gunicorn package should be mentioned in the requirements.txt file.

kiranr
  • 2,087
  • 14
  • 32