我正在尝试在守护进程模式下使用apache和mod_wsgi在共享主机环境中运行Odoo(openERP)实例,这意味着我没有超级用户权限。
此应用程序需要较少的编译器才能正常工作,并且由于系统没有安装node / lessc,因此我为用户自定义了一个节点,并将二进制文件添加到我的路径中。问题是apache正在为另一个用户运行而我无法使用wsgi应用程序来压缩lessc命令。
我如何让node和lessc为我的用户工作:
export PATH=~/apps_wsgi/node/bin:$PATH
我的python版本是2.7.10,这里有一些系统信息:
[admsolariza@web7695 ~]$ cat /proc/version
Linux version 4.11.6-1.el6.elrepo.x86_64 (mockbuild@Build64R6) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Sat Jun 17 10:32:49 EDT 2017
[admsolariza@web7695 ~]$ node -v
v6.11.1
[admsolariza@web7695 ~]$ npm -v
3.10.10
[admsolariza@web7695 ~]$ lessc -v
lessc 2.7.2 (Less Compiler) [JavaScript]
这是我的wsgi脚本:
import sys, os
venv_path = '/home/admsolariza/apps_wsgi/odoo_env/lib/python2.7/site-packages'
if venv_path not in sys.path:
sys.path.insert(0, venv_path)
project_path = '/home/admsolariza/apps_wsgi/odoo'
if project_path not in sys.path:
sys.path.insert(0, project_path)
node_path = '/home/admsolariza/apps_wsgi/node/bin'
if node_path not in sys.path:
sys.path.insert(0, node_path)
import commands
status, output = commands.getstatusoutput("lessc")
with open('apps_wsgi/log', 'w') as f:
f.write(output)
import odoo
#----------------------------------------------------------
# Common
#----------------------------------------------------------
odoo.multi_process = True # Nah!
# Equivalent of --load command-line option
odoo.conf.server_wide_modules = ['web']
conf = odoo.tools.config
# Path to the OpenERP Addons repository (comma-separated for
# multiple locations)
conf['addons_path'] = os.path.join(project_path, 'addons')
# Optional database config if not using local socket
conf['db_name'] = 'foo'
conf['db_host'] = 'bar'
conf['db_user'] = 'foo'
#conf['db_port'] = 5432
conf['db_password'] = 'bar'
#----------------------------------------------------------
# Generic WSGI handlers application
#----------------------------------------------------------
application = odoo.service.wsgi_server.application
odoo.service.server.load_server_wide_modules()
wsgi脚本创建的日志文件的内容:
sh: lessc: command not found
我的期望是找到并正常工作的lessc命令。有什么想法吗?