Apache和Windows 7上的mod_wsgi
我在Win 7上安装了Apache和mod_wsgi,并将mod_wsgi的配置文本输出复制到httpd.conf中.
I installed Apache and mod_wsgi on Win 7 and copied config text output of mod_wsgi into httpd.conf.
我还检查并看到服务器在mod_wsgi之前运行.
I also check and see server working before mod_wsgi.
现在,当我尝试在本地主机上进行连接时,连接被拒绝.经过一番研究,我发现我应该将mod_wsgi.server添加到我的应用程序设置中.我这样做并运行runmodwsgi失败,因为它正在Windows中运行使用os.getuid的脚本.在Windows中无效.是否必须在Django项目中将mod_wsgi添加到已安装的应用程序中?在此处中未提及.
Now when I try to connect on local host I get a connection refused. After some research I found out I should add mod_wsgi.server to my app settings. I did it and ran runmodwsgi which failed because it was running a script in Windows which used os.getuid. Not valid in Windows. Is it mandatory to add mod_wsgi to isntalled apps in django project? Not mentioned in here.
如果是的话,我该如何在Windows中对os.getuid进行处理?
If so what can I do for os.getuid in Windows?
除了这些原因之外,如果仅我的处理程序配置不正确,为什么我会拒绝连接并且没有日志.
Beside these why I get connection refused and no log if only my handler config is incorrect.
我从cmd运行了httpd并发现了错误:
I ran httpd from cmd and found the error:
[2018年12月21日星期五10:11:17.538864] [wsgi:info] [pid 64084:tid 180] mod_wsgi(pid = 64084):初始化Python.致命的Python错误: Py_Initialize:无法加载文件系统编解码器 ModuleNotFoundError:没有名为编码"的模块
[Fri Dec 21 10:11:17.538864 2018] [wsgi:info] [pid 64084:tid 180] mod_wsgi (pid=64084): Initializing Python. Fatal Python error: Py_Initialize: unable to load the file system codec ModuleNotFoundError: No module named 'encodings'
尚不知道原因.
[更新] 将PYTHONHOME更改为python基本路径,并且现在可以正常工作. venv和setuptools之间的兼容性最大.
[UPDATE] Changed PYTHONHOME to python base path and it is working now. There most be an in compatibility between venv and setuptools.