Django:启动supervisorctl时出错:/不存在名为___

时间:2018-10-26 05:08:18

标签: python django

我有一个使用命令重新启动的Django应用

ubuntu@ip-1234:~$sudo supervisorctl restart myapp

myapp: stopped
myapp: started

ubuntu@ip-1234:~$ sudo systemctl restart nginx
ubuntu@ip-1234:~$ sudo systemctl reload nginx

但是,当我进入域名(debug = True)时,出现错误消息:

ImportError at /
No module named pdfrw

但是,如果我导航回到我的应用并尝试下载软件包

ubuntu@ip-1234:~$sudo -i -u myapp
myapp@ip-1234:~$ pip install pdfrw
Requirement already satisfied: pdfrw in ./.local/lib/python2.7/site-packages

我不确定为什么在生产中找不到此包装。我曾经能够使它正常工作,我想我的软件包的安装位置出了点问题。如果删除代码中的from pdfrw import PdfDict行,我的应用程序将正常运行。也许与权限有关?

我的主管配置位于/etc/supervisor/conf.d/myapp.conf

[program:myapp]
command = /webapps/program:myapp_django/bin/gunicorn_start                    ; Command to start app
user = program:myapp                                                          ; User to run as
stdout_logfile = /webapps/program:myapp_django/logs/gunicorn_supervisor.log   ; Where to write log messages
redirect_stderr = true                                                ; Save stderr in the same log
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8                       ; Set UTF-8 as default encoding

1 个答案:

答案 0 :(得分:0)

解决了!

>>> import mylib >>> t = mylib.TimesTwo() >>> t.getValue() 5.25 >>> t.divide() 2.625

我将软件包安装到错误的位置。