V
V
vikholodov2018-07-27 10:31:41
Django
vikholodov, 2018-07-27 10:31:41

Why does gunicorn swear and won't start?

I'm moving from 1 server to another, copy-pasted all the configs adjusted for the new user, everything starts with the exception of the gunicorn.
Trying to run

gunicorn --bind 0.0.0.0:8000 gamemode.wsgi:application

And I get:
[2018-07-27 10:24:42 +0300] [8742] [INFO] Starting gunicorn 19.9.0
[2018-07-27 10:24:42 +0300] [8742] [INFO] Listening at: http://0.0.0.0:8000 (8742)
[2018-07-27 10:24:42 +0300] [8742] [INFO] Using worker: sync
[2018-07-27 10:24:42 +0300] [8745] [INFO] Booting worker with pid: 8745
[2018-07-27 10:24:42 +0300] [8745] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.5/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.5/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.5/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.5/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.5/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.5/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/home/vikholodov/gamemode_prj/gamemode/gamemode/__init__.py", line 6, in <module>
    from .celery_app import app as celery_app  # noqa
  File "/home/vikholodov/gamemode_prj/gamemode/gamemode/celery_app.py", line 3, in <module>
    from celery import Celery
ImportError: No module named 'celery'
[2018-07-27 10:24:42 +0300] [8745] [INFO] Worker exiting (pid: 8745)
[2018-07-27 10:24:42 +0300] [8742] [INFO] Shutting down: Master

Celery is up and running, I googled, they say, I need to rename celery.py to celery_app.py (I didn’t understand why it worked before), it didn’t help.
What could be the problem?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
vikholodov, 2018-07-27
@vikholodov

In general, the good old way helped, reinstalled gunicorn and it all worked

V
Vadim Shatalov, 2018-07-27
@netpastor

ImportError: No module named 'celery' means that gunicorn does not see celery in installed
packages

S
Stormwalker, 2018-07-27
@Stormwalker

You're using the global environment, which will mess up the versions of the libraries. Create a virtual environment and run your application in it. There are different packages for this, I usually use venv.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question