在此tutorial的帮助下,我正在尝试将我的第一个应用程序部署到数字海洋。
当我尝试运行sudo administratorctl restart [appname]时,出现以下错误。 (这只是错误的一部分)
[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'
我在服务器上的设置是
和主管配置文件
#!/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
和gunicorn_start文件
#!/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=-
我在做什么错了?
答案 0 :(得分:0)
基于productUploader
目录似乎是一个python软件包,这是基于您将其以虚线路径传递到DJANGO_SETTINGS_MODULE
和DJANGO_WSGI_MODULE
的事实。因此,您还应该对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',
]