I am using a MS Windows 11 Machine running Python 3.11 with virtualenv package installed.
I am using Apache24 httpd.exe web server for my django app production server.
My app is called mysite and it is fully functional inside a virtual environment (called venv) with the folowing packages (requirements.txt):
django
django-extensions
django-iprestrict
mod-wsgi
Pillow
pyOpenSSL
odfpy
werkzeug
whitenoise
pandas
plotly
matplotlib
I can fully run the server in DEBUG mode with the virtual environment activated:
(venv) python.exe manage.py runserver
And, on the other hand, I was able to make the Apache web server to run a test website without problems.
The issue is when I edit httpd.conf files to integrate with my django app thorugh mod_wsgi:
# httpd.conf
(...)
LoadFile "C:/Users/myuser/AppData/Local/Programs/Python/Python311/python311.dll"
LoadModule "C:/Users/myuser/mysite/mysite_venv/venv/Lib/site-packages/mod_wsgi.cp311-win_amd64.pyd"
WSGIScriptAlias / C:\Users\myuser\mysite\mysite\wsgi.py
WSGIPythonHome C:\Users\myuser\mysite\mysite_venv\venv
WSGIPythonPath C:\Users\myuser\mysite
<Directory />
<Files wsgi.py>
Require all granted
</Files>
</Directory>
# media files hosting
Alias /media "C:/Users/myuser/mysite/media/"
<Directory "C:/Users/myuser/mysite/media/">
Require all granted
</Directory>
(...)
My directory tree is:
.
├── mainapp
│   ├── admin.py
│   ├── apps.py
│   ├── forms.py
│   ├── __init__.py
│   ├── migrations
│   ├── models.py
│   ├── static
│   ├── templates
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── mainapp.sqlite3
├── manage.py
├── media
├── mysite
│   ├── asgi.py
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── mysite_venv
│   ├── requirements.txt
│   ├── venv
└── staticfiles
    ├── admin
    ├── css
    ├── django_extensions
    ├── font
    ├── icon
    ├── javascript
    ├── js
    └── uploads
The issue is when I run httpd.exe the web page loads forever because the server does not respond the client.
I have opened the error.txt log file from Apache to find out what is going on, but there was any error message about anything.
I took care about:
- setting PYTHONPATHenvironment variable to the DLLs as described here
- natively compile and place the mod_wsgi.pydin the correct path.
Can someone help me what is going on? Thanks in advance!
