【发布时间】:2023-04-01 01:04:02
【问题描述】:
我有一个使用 cx_Oracle(在 virtualenv 中)的 Python 项目(在 Ubuntu 12.04 上运行)。当我运行项目时,导入这个模块没有问题。现在我想使用主管控制我的项目。当我从主管启动项目时,启动崩溃并引发此异常:
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
worker.init_process()
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/util.py", line 352, in import_app
__import__(module)
File "/vagrant/scrapy_server/flask_server/api.py", line 8, in <module>
from resources.routes import routes
File "/vagrant/scrapy_server/flask_server/resources/routes.py", line 1, in <module>
from server.server import ServerStart, ServerStatus, ServerStop
File "/vagrant/scrapy_server/flask_server/resources/server/server.py", line 8, in <module>
from core.pool import ThreadPool
File "/home/vagrant/scrapy/src/scrapy/scrapy_server/apps/core/pool.py", line 7, in <module>
from resources.resources import Resources
File "/vagrant/scrapy_server/flask_server/resources/resources.py", line 10, in <module>
from repository.HotTypes import HotTypes
File "/vagrant/scrapy_server/flask_server/resources/repository/HotTypes.py", line 1, in <module>
from db_pg import DBPostgres
File "/vagrant/scrapy_server/flask_server/resources/repository/db_pg.py", line 1, in <module>
from resources.db_pg import DBPostgres as DBpostgresResources
File "/vagrant/scrapy_server/flask_server/resources/db_pg.py", line 1, in <module>
from core.dbcore import DBpostgresCore
File "/home/vagrant/scrapy/src/scrapy/scrapy_server/apps/core/dbcore.py", line 3, in <module>
import cx_Oracle
ImportError: libclntsh.so.11.1: cannot open shared object file: No such file or directory
我遵循了this 站点和this other 站点的指示。但我无法解决这个问题。
主管配置文件是:
[program:api_server]
command = /home/vagrant/scrapy/bin/gunicorn api:app
directory = /home/vagrant/scrapy/src/scrapy/scrapy_server/flask_server/
environment = PATH="/home/vagrant/scrapy/bin/python", ORACLE_HOME="/usr/lib/oracle/12.1/client64", LD_LIBRARY_PATH="/usr/lib/oracle/12.1/client64/lib"
user = vagrant
autostart=true
autorestart=true
stderr_logfile=/var/log/api.err.log
stdout_logfile=/var/log/api.out.log
redirect_stderr = True
我在这里缺少什么?如果您需要更多信息,请告诉我,我会更新这个问题。
谢谢大家
【问题讨论】:
-
您是否设置了所有必需的环境变量(如 $ORACLE_HOME、...)?
-
是的,正如我所写,我设置了教程中解释的所有环境变量(链接在上面)。如果我手动启动,项目运行完美
标签: python gunicorn supervisord cx-oracle