已经在CentOS7日报运行了django程序。
我想让centos7成为centos8。
我在尝试CentOS8。这是wsgi设置。
# dnf -y install python3-mod_wsgi
# vi /etc/httpd/conf.d/python3_wsgi.conf这是新文件。写入新文件。
WSGIScriptAlias /test_wsgi /var/www/html/test_wsgi.pydef application(environ, start_response):
status = '200 OK'
html = '<html>\n' \
'<body>\n' \
'<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">\n' \
'WSGI TEST PAGE\n' \
'</div>\n' \
'</body>\n' \
'</html>\n'.encode("utf-8")
response_header = [('Content-type','text/html')]
start_response(status,response_header)
return [html]# systemctl restart httpdurl输入到铬http://153.127.13.226/test_wsgi。
好的!它起作用了!和wsgi一起!
但是用venv创建django项目,就不能用一个了。
url输入到铬http://153.127.13.226/test_wsgi。
铬是..。哦不!503!
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.文科目录是..。
# python -c 'import sys; print(sys.prefix)'
/home/op/venvdjango项目..。
# tree /var/www/html
/var/www/html
├ index.html
├ test_wsgi.py
└ testproject
├ manage.py
└ testproject
├ __init__.py
├ asgi.py
├ settings.py
├ urls.py
└ wsgi.pyWSGIDaemonProcess test_app python-path=/var/www/html/testproject python-home=/home/op/venv
WSGIProcessGroup test_app
WSGIScriptAlias /test_wsgi /var/www/html/testproject/testproject/wsgi.py
<Directory /var/www/html/testproject>
Require all granted
</Directory>错误日志是..。好像没完没了。
# tail -f /var/log/httpd/error_logCurrent thread 0x00007f65e9c55900 (most recent call first):
[Mon Mar 23 21:13:57.702501 2020] [core:notice] [pid 26583:tid 140075690449152] AH00052: child pid 7780 exit signal Aborted (6)
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'我已经在流中搜索堆栈,但尚未解决。
我想是多了一点,但我有堆越流。
发布于 2020-03-27 15:47:41
好的!我解决了!
但我做了很多次操作系统重置。
这个错误没有重现。
可能是因为“SELinux”
现在,我不知道原因是什么,所以我将介绍最后的设置内容和网址,总结这个过程(对不起,日语)
django项目名称: mysite
LoadModule wsgi_module /var/www/html/venv/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so
WSGIScriptAlias / /var/www/html/mysite/mysite/wsgi.py
WSGIDaemonProcess wsgi_app python-home=/var/www/html/venv python-path=/var/www/html/mysite
WSGIProcessGroup wsgi_app
WSGISocketPrefix /var/run/wsgihttps://stackoverflow.com/questions/60813483
复制相似问题