rakeshh92
rakeshh92

Reputation: 985

Error while running gunicorn in django

I am getting error while running gunicorn.

Started gunicorn daemon.
Starting gunicorn daemon...
[2018-07-15 07:39:16 +0000] [11359] [INFO] Starting gunicorn 19.9.0
[2018-07-15 07:39:16 +0000] [11359] [INFO] Listening at: http://0.0.0.0:4000 (11359)
[2018-07-15 07:39:16 +0000] [11359] [INFO] Using worker: sync
[2018-07-15 07:39:16 +0000] [11362] [INFO] Booting worker with pid: 11362
[2018-07-15 07:39:16 +0000] [11362] [ERROR] Exception in worker process
Traceback (most recent call last):File "/home/ec2-user/bankserver/env/lib   /python3.6/site-packages/gunicorn/arbiter.py", lineworker.init_process()
File "/home/ec2-user/bankserver/env/lib/python3.6/site-packages/gunicorn /workers/base.py",self.load_wsgi()
File "/home/ec2-user/bankserver/env/lib/python3.6/site-packages/gunicorn/workers/base.py",self.wsgi = self.app.wsgi()
File "/home/ec2-user/bankserver/env/lib/python3.6/site-packages/gunicorn/app/base.py", linself.callable = self.load()
File "/home/ec2-user/bankserver/env/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",return self.load_wsgiapp()
File "/home/ec2-user/bankserver/env/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",return util.import_app(self.app_uri)
File "/home/ec2-user/bankserver/env/lib/python3.6/site-packages/gunicorn/util.py", line 35
__import__(module)
ModuleNotFoundError: No module named 'aggregator'
[2018-07-15 07:39:16 +0000] [11362] [INFO] Worker exiting (pid: 11362)
[2018-07-15 07:39:16 +0000] [11359] [INFO] Shutting down: Master
[2018-07-15 07:39:16 +0000] [11359] [INFO] Reason: Worker failed to boot.
gunicorn.service: main process exited, code=exited, status=3/NOTIMPLEMENTED
Unit gunicorn.service entered failed state.
gunicorn.service failed.

Installed path: I have installed virtual env in : /home/ec2-user/bserver/env/bin/* I have django application in : /home/ec2-user/sigma_app/django_app_04-07-2018/aggregator(here aggregator is project name)

gunicorn.service contains:

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=ec2-user
Group=ec2-user
WorkingDirectory=/home/ec2-user/sigma_app/django_app_04-07-2018/aggregator
ExecStart=/home/ec2-user/bserver/env/bin/python3.6 /home/ec2-user/bserver/env/bin/gunicorn --workers 3 --bind :4000 aggregator.wsgi:application

Upvotes: 1

Views: 1101

Answers (1)

rakeshh92
rakeshh92

Reputation: 985

I found the solution myself.

I have replaced the working directory from

WorkingDirectory=/home/ec2-user/sigma_app/django_app_04-07-2018/aggregator to

WorkingDirectory=/home/ec2-user/sigma_app/django_app_04-07-2018

It worked for me

Upvotes: 1

Related Questions