无法使用apache2 mod_wsgi

我在ubunu 18.04(apache2)上安装odoo v13时遇到了问题

我可以通过odoo-bin进行测试/开发,但是尝试将其从我的本地计算机上发布 (我们的网络上有一个代理,但现在我想让它运行,这样我就可以得到它) 香港专业教育学院设置odoo.conf吐出错误odoo-error.log确实可以吐出一些错误。但仅在systemctl restart apache2之后 然后停止
  

从守护进程收到的截断或过大的响应头   '管理员':/opt/odoo13/E-Forms/odoo/setup/odoo-wsgi.py

ive完成了目录的所有权限访问 但是我发现apache很奇怪,是在默认错误文件中我得到了

  

致命的Python错误:Py_Initialize:无法获取区域设置编码   ModuleNotFoundError:没有名为“编码”的模块

及其连续不断让我感到困惑,如果我告诉Virtualhost嘿,我将所有错误都放在odoo-error.log上,为什么error.log仍然不断被填充,但是我希望这与我的问题无关

这是我的朋友

    ServerName test.eforms.com
    ServerAlias test.eforms.com 127.0.0.1

    ErrorLog ${APACHE_LOG_DIR}/odoo-error.log
    CustomLog ${APACHE_LOG_DIR}/odoo-access.log combined
    LogLevel info

    <Directory /opt/odoo13/E-Forms>
        Require all granted
    </Directory>
    <Directory /opt/odoo13/E-Forms/odoo/setup>
        <Files odoo-wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIDaemonProcess admin user=admin group=admin processes=1 python-home=/opt/odoo13/Venv/odoovenv/bin/ python-path=/opt/odoo13/E-Forms/odoo
    WSGIProcessGroup admin
    WSGIScriptAlias / /opt/odoo13/E-Forms/odoo/setup/odoo-wsgi.py
    WSGIApplicationGroup %{GLOBAL}

</VirtualHost>

这是我的odoo-wsgi.py(这是克隆的副本)

import odoo

#----------------------------------------------------------
# Common
#----------------------------------------------------------
odoo.multi_process = True # Nah!
# Equivalent of --load command-line option
odoo.conf.server_wide_modules = ['base','web']
conf = odoo.tools.config
# Path to the OpenERP Addons repository (comma-separated for
# multiple locations)
conf['addons_path'] = '/opt/odoo13/E-Forms/odoo/addons,/opt/odoo13/E-Forms/odoo/custom'
# Optional database config if not using local socket
conf['db_name'] = 'EForm'
conf['db_host'] = 'localhost'
conf['db_user'] = 'odoo'
conf['db_port'] = 5432
conf['db_password'] = 'password'
#----------------------------------------------------------
# Generic WSGI handlers application
#----------------------------------------------------------
application = odoo.service.wsgi_server.application

odoo.service.server.load_server_wide_modules()
#----------------------------------------------------------
# Gunicorn
#----------------------------------------------------------
# Standard OpenERP XML-RPC port is 8069
bind = '127.0.0.1:80'
pidfile = '.gunicorn.pid'
workers = 1
timeout = 1200

和我的apache2.conf在这里

ServerName test.eforms.com


DefaultRuntimeDir ${APACHE_RUN_DIR}


PidFile ${APACHE_PID_FILE}

Timeout 900


KeepAlive On


MaxKeepAliveRequests 100


KeepAliveTimeout 5

User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}


HostnameLookups On

ErrorLog ${APACHE_LOG_DIR}/error.log


#LogLevel info

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf



<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

accessFileName .htaccess


<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>

Loadmodule wsgi_module modules/mod_wsgi.so

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent


# see README.Debian for details.


IncludeOptional conf-enabled/*.conf


IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

我从源代码下载了mod_wsgi.so并进行了安装 以下是仅安装了apache2的所有apt软件包的列表

  

apache2 / bionic-updates,bionic-security,now 2.4.29-1ubuntu4.11 amd64   [已安装] apache2-bin / bionic-updates,bionic-security,现在   2.4.29-1ubuntu4.11 amd64 [已安装,自动] apache2-数据/仿生更新,仿生更新,仿生安全,仿生安全,现在   2.4.29-1ubuntu4.11全部[已安装,自动] apache2-dev / bionic-updates,bionic-security,现在为2.4.29-1ubuntu4.11   amd64 [已安装] apache2-utils / bionic-updates,bionic-security,现在   2.4.29-1ubuntu4.11 amd64 [已安装,自动] libapache2-mod-wsgi-py3 / bionic,现在是4.5.17-1 amd64 [已安装]

我的点子冻结了

  

Babel == 2.3.4 certifi == 2019.9.11 chardet == 3.0.4装饰器== 4.0.10   Django == 2.2.6 docopt == 0.6.2 docutils == 0.12 h11 == 0.8.1 h2 == 3.1.1   hpack == 3.0.0 html2text == 2019.9.26超帧== 5.2.0 idna == 2.8   图片== 1.5.27 Jinja2 == 2.10.3 libsass == 0.19.3 lxml == 4.4.1   MarkupSafe == 1.1.1 num2words == 0.5.10 passlib == 1.7.1枕头== 6.2.0   pkg-资源== 0.0.0 polib == 1.1.0 psutil == 5.6.3 psycogreen == 1.0.1   psycopg2 == 2.8.4 psycopg2-binary == 2.8.4 pyasn1 == 0.4.7   pyasn1-modules == 0.2.7 pyldap == 3.0.0.post1 pypDF2 == 1.26.0   python-dateutil == 2.8.0 python-ldap == 3.2.0 python-openid == 2.2.5   python-stdnum == 1.11 pytz == 2016.7 reportlab == 3.5.28个请求== 2.22.0   rfc3986 == 1.3.2六个== 1.12.0 sqlparse == 0.3.0 urllib3 == 1.25.6   Werkzeug == 0.16.0 xlwt == 1.3.0

lcq3822987 回答:无法使用apache2 mod_wsgi

挠头三天后,我终于发现了问题所在,这是这行

  

python-home = / opt / odoo13 / Venv / odoovenv / bin /

应该是

  

python-home = / opt / odoo13 / Venv / odoovenv /

所以将来有人在这里遇到这样的问题

  • 再次检查您的mod_wsgi是否使用与python相同的版本 您的virtualenv
  • 确保您更新了所有软件包(我使用ubuntu这样 会很合适)
  • 确保wsgiprocessgroup具有目录和 SUB的所有rwx 目录(您可能在其中托管应用程序)
本文链接:https://www.f2er.com/3063768.html

大家都在问