Reputation: 293
I'm trying to deploy my first app to digital ocean with help of this tutorial.
When I try to run sudo supervisorctl restart [appname], I get the following error. (This is only a part of the error)
[2019-01-16 09:10:49 +0000] [2653] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/home/srimal/django_project/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/home/srimal/django_project/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/home/srimal/django_project/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/srimal/django_project/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/srimal/django_project/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/home/srimal/django_project/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/srimal/django_project/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/home/srimal/django_project/productUploader/shadesProductUploader/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/home/srimal/django_project/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/home/srimal/django_project/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/srimal/django_project/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/home/srimal/django_project/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/home/srimal/django_project/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'authSection'
My setup in the server is
and the supervisor config file
#!/bin/sh
[program:productUploader]
command=/home/srimal/django_project/bin/gunicorn_start
user=srimal
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/srimal/logs/gunicorn-error.log
and the gunicorn_start file
#!/bin/bash
NAME="productUploader"
DIR=/home/srimal/django_project
USER=srimal
GROUP=srimal
WORKERS=3
BIND=unix:/home/srimal/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=productUploader.shadesProductUploader.settings
DJANGO_WSGI_MODULE=productUploader.shadesProductUploader.wsgi
LOG_LEVEL=error
cd $DIR
source /home/srimal/django_project/bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DIR:$PYTHONPATH
exec /home/srimal/django_project/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $WORKERS \
--user=$USER \
--group=$GROUP \
--bind=$BIND \
--log-level=$LOG_LEVEL \
--log-file=-
What am I doing wrong?
Upvotes: 1
Views: 304
Reputation: 22994
It seems as though the productUploader
directory is a python package, based on the fact that you're passing it in the dotted path to DJANGO_SETTINGS_MODULE
and DJANGO_WSGI_MODULE
. Thus you should also do the same for the apps in INSTALLED_APPS
:
INSTALLED_APPS = [
'productUploader.authSection', # Use full path
'productUploader.mainSection', # Use full path
'django.contrib.humanize',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
Upvotes: 1