What did 'mod_wsgi-express module-config' output and what did you stick in the 
Apache configuration file?

> On 21 Dec 2018, at 9:56 pm, Siavosh Kasravi <[email protected]> wrote:
> 
> Doing things like copying around these directories is a bad idea. It is just 
> going to hide whatever is the real problem and potentially cause other issues.
> Yes. That is exactly why I mentioned it.
> 
>  Do be aware that if running Apache as a service, then Python must have been 
> installed for all users and not just yourself, otherwise the Apache service 
> will not be able to find the Python installation at run time. The Apache 
> service also needs to be able to access the directories where your Python 
> virtual environment and application code is.
> I believe those requirement are met.
> 
>  I would suggest recreating your Python virtual environment, especially if 
> you updated Python after it was originally created. If need be you may have 
> to reinstall Python.
> Wonderful! That is exactly what I did. I created a new venv then updated pip 
> and setuptools, after that installed mod_wsgi and same linker error hit me. 
> Did the bad copy thing again and this time mod_wsgi got installed. 
> Reconfigured the https.conf finaly but then again Py_Initialize happend. So I 
> suspected there is an issue with the venv. Based on that Changed PYTHONHOME 
> to python base path and it is working now. There may be an in compatibility 
> between venv and setuptools. sutuptools in venv is addressing dependencies in 
> venv while they should be in base.
> 
> On Friday, December 21, 2018 at 10:22:22 AM UTC+3:30, Graham Dumpleton wrote:
> Doing things like copying around these directories is a bad idea. It is just 
> going to hide whatever is the real problem and potentially cause other issues.
> 
> Do be aware that if running Apache as a service, then Python must have been 
> installed for all users and not just yourself, otherwise the Apache service 
> will not be able to find the Python installation at run time. The Apache 
> service also needs to be able to access the directories where your Python 
> virtual environment and application code is.
> 
> I would suggest recreating your Python virtual environment, especially if you 
> updated Python after it was originally created. If need be you may have to 
> reinstall Python.
> 
>> On 21 Dec 2018, at 5:44 pm, Siavosh Kasravi <siavosh...@ <>gmail.com 
>> <http://gmail.com/>> wrote:
>> 
>> A bit of history:
>> When I created my virtual env for Python and upgraded setuptools and pip 
>> then installed mod_wsgi, MSVC Linker failed because it couldn't find 
>> "vevn/scripts/libs/pytho36.lib" so I had to copy libs folder from Python 
>> base to my venv/scripts. Don't know if it is relevant but I found the error. 
>> :-)
>> 
>> When I run httpd directly from cmd it logs 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'
>> 
>> 
>> 
>> On Friday, December 21, 2018 at 1:28:49 AM UTC+3:30, Graham Dumpleton wrote:
>> 
>> 
>>> On 21 Dec 2018, at 8:55 am, Siavosh Kasravi <[email protected] <>> wrote:
>>> 
>>>  
>>> What exact command are you running and what error do you get.
>>> 
>>> Exact command: mod_wsgi-express install-module
>>> Exact Error: "Usage: mod_wsgi-express command [params]
>>> 
>>> Commands:
>>>     module-config
>>>     module-location
>> 
>> For Windows you are meant to run:
>> 
>>     mod_wsgi-express module-config
>> 
>> and copy the output from that into your existing Apache configuration file.
>> 
>>> mod_wsgi-express: error: Invalid command was specified."
>>> 
>>> You can't use 'mod_wsgi-express start-server' or 'python manage.py 
>>> runmodwsgi' on Windows. They only work on Unix type systems.
>>> 
>>> So how can I configure my django app?
>> 
>> Once you have added in the output of 'module-config', then configure Apache 
>> as described in Django documentation. Just be aware that you can't use 
>> daemon mode on Windows.
>> 
>> https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/modwsgi/ 
>> <https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/modwsgi/>
>>> 
>>> What Python version are you using? What version of MS C/C++ compiler? What 
>>> distribution of Apache?
>>> Python: x64 v3.6
>>> VC: x64 15.6.4
>>> Apache: httpd-2.4.37-win64-VC15 (ApacheLounge)
>>> 
>>> I suspected setup.py when it installed mod_wsgi because it usec x86_amd64 
>>> instead of x64 for compilation. But thought the target would be c64 anyway.
>>> Thank you
>>> On Thursday, December 20, 2018 at 9:37:03 AM UTC+3:30, Graham Dumpleton 
>>> wrote:
>>> 
>>> 
>>>> On 20 Dec 2018, at 4:11 pm, Siavosh Kasravi <[email protected] <>> 
>>>> wrote:
>>>> 
>>>> I have three related problems:
>>>> 
>>>> In this page <https://pypi.org/project/mod_wsgi/> "mod_wsgi-express 
>>>> module-config" gives a .so module to be used in Apache conf. But when I 
>>>> ran it in Windows it gave me a .pyd. Is it normal?
>>> 
>>> Yes it is normal. Windows will use a .pyd or .pyo extension and not .so.
>>> 
>>>> ("mod_wsgi-express install-module" noted in the same page doesn't work at 
>>>> all!)
>>> 
>>> What exact command are you running and what error do you get.
>>> 
>>>> 
>>>> Another issue is running "python manage.py runmodwsgi" in Windows fails 
>>>> because script tries to call os.getuid, which is not available in Windows.
>>> 
>>> You can't use 'mod_wsgi-express start-server' or 'python manage.py 
>>> runmodwsgi' on Windows. They only work on Unix type systems.
>>> 
>>>> Currently server stops functioning correctly when loads .pyd module.
>>> 
>>> A failure of Apache to start up usually means, one of the following.
>>> 
>>> * You aren't using the same compiler as the Python version was compiled 
>>> with. See:
>>> 
>>>     https://wiki.python.org/moin/WindowsCompilers 
>>> <https://www.google.com/url?q=https%3A%2F%2Fwiki.python.org%2Fmoin%2FWindowsCompilers&sa=D&sntz=1&usg=AFQjCNHx91mD8iBLYRVivOaLgI5AASATcg>
>>> 
>>> for the correct compiler you should be used.
>>> 
>>> * You aren't using all 64 bit for Apache, Python and the compiler. You 
>>> can't mix 32 bit and 64 bit. Don't recommend using 32 bit at all.
>>> 
>>> * You are trying to use Python 2.7. Give up on that. It is impossible to 
>>> find Apache which is compiled with the old compiler that Python 2.7 
>>> requires. If you mix Python/Apache C compiler runs times, eg VC9 and VC14, 
>>> it usually doesn't work.
>>> 
>>> * You aren't using ApacheLounge distribution of Apache. Some of the other 
>>> distributions of Apache just don't work, although usually you can't even 
>>> get things to compile.
>>> 
>>> Having said all that. What Python version are you using? What version of MS 
>>> C/C++ compiler? What distribution of Apache?
>>> 
>>> Graham
>>> 
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "modwsgi" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to modwsgi+u...@ <>googlegroups.com <http://googlegroups.com/>.
>>> To post to this group, send email to mod...@ <>googlegroups.com 
>>> <http://googlegroups.com/>.
>>> Visit this group at https://groups.google.com/group/modwsgi 
>>> <https://groups.google.com/group/modwsgi>.
>>> For more options, visit https://groups.google.com/d/optout 
>>> <https://groups.google.com/d/optout>.
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "modwsgi" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <>.
>> To post to this group, send email to [email protected] <>.
>> Visit this group at https://groups.google.com/group/modwsgi 
>> <https://groups.google.com/group/modwsgi>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to