I'm setting up a Django project with Apache and mod_wsgi on macOS using Homebrew. When I restart the Apache server, I encounter the following error:
httpd: Syntax error on line 67 of /usr/local/etc/httpd/httpd.conf: Cannot load /usr/local/lib/httpd/modules/mod_wsgi.so into server: dlopen(/usr/local/lib/httpd/modules/mod_wsgi.so, 0x000A): Library not loaded: @rpath/libpython3.9.dylib Referenced from: /usr/local/Cellar/httpd/2.4.58/lib/httpd/modules/mod_wsgi.so Reason: no LC_RPATH's found
context:
- Installed Apache using Homebrew.
- Installed mod_wsgi using pip.
- Apache configuration file (httpd.conf) includes the following block:
<VirtualHost *:8080>
ServerName webmaster@localhost
DocumentRoot /var/www/html
Alias /static /Users/abbasahmed/Desktop/AWD/topic9/bioweb/static
<Directory /Users/abbasahmed/Desktop/AWD/topic9/bioweb/static>
Require all granted
</Directory>
<Directory /Users/abbasahmed/Desktop/AWD/topic9/bioweb/bioweb>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess bioweb python-path=/Users/abbasahmed/Desktop/AWD/topic9/bioweb python-home=/Users/abbasahmed/Desktop/AWD/topic9/envs/bioweb_install
WSGIProcessGroup bioweb
WSGIScriptAlias / /Users/abbasahmed/Desktop/AWD/topic9/bioweb/bioweb/wsgi.py
</VirtualHost>
I also include this with the other module loading code in the config file
LoadModule wsgi_module /usr/local/lib/httpd/modules/mod_wsgi.so
I'm facing an issue with Apache and mod_wsgi on macOS. The error suggests a problem with the library path (@rpath/libpython3.9.dylib). How can I resolve this issue and successfully load mod_wsgi.so into the Apache server?
I uninstalled and installed mod_wsgi with the correct python version but I still get an error