mod_wsgi on Apache and Windows 7

2019-08-20 09:25发布

I installed Apache and mod_wsgi on Win 7 and copied config text output of mod_wsgi into httpd.conf.

I also check and see server working before 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.

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.

1条回答
贪生不怕死
2楼-- · 2019-08-20 09:57

I ran httpd from cmd and found the error:

[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'

Don't know the reason yet.

[UPDATE] Changed PYTHONHOME to python base path and it is working now. There most be an in compatibility between venv and setuptools.

查看更多
登录 后发表回答