Django WSGI Apache

I am developing a Django Application and currently experiencing issue during WSGI + Apache integration.

Below are my server configuration

RHEL : 8.6 
Python : 3.6.8 
Apache : 2.4.37

After following various tutorials i have the following configurations under my httpd.conf, app.wsgi

My httpd.conf file look like this

LoadModule wsgi_module modules/mod_wsgi.so

WSGIDaemonProcess django_project python-path=/home/project user=apache group=developers
WSGIProcessGroup django_project
WSGIScriptAlias / /home/project/myapp/wsgi.py process-group=django_project
<Directory /home/project/myapp>
        <Files wsgi.py>
                Require all granted
        </Files>
</Directory>

My wsgi file look like this

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')

application = get_wsgi_application()

Here is the error message which i get under my httpd log

[Mon Aug 29 09:49:19.786017 2022] [mime_magic:error] [pid 721666:tid 140511423796992] [client 192.168.1.112:49310] AH01512: mod_mime_magic: can't read `/home/project/myapp/wsgi.py'
[Mon Aug 29 09:49:19.786118 2022] [mime_magic:error] [pid 721666:tid 140511423796992] [client 192.168.1.112:49310] AH01512: mod_mime_magic: can't read `/home/project/myapp/wsgi.py'
[Mon Aug 29 09:49:19.786443 2022] [wsgi:error] [pid 721665:tid 140511574705920] (13)Permission denied: [remote 192.168.1.112:49310] mod_wsgi (pid=721665, process='django_project', application='192.168.1.114|'): Could not read/compile source file '/home/project/myapp/wsgi.py'.
[Mon Aug 29 09:49:19.786503 2022] [wsgi:error] [pid 721665:tid 140511574705920] [remote 192.168.1.112:49310] mod_wsgi (pid=721665): Exception occurred processing WSGI script '/home/project/myapp/wsgi.py'.
[Mon Aug 29 09:49:19.786564 2022] [wsgi:error] [pid 721665:tid 140511574705920] [remote 192.168.1.112:49310] PermissionError: [Errno 13] Permission denied: '/home/project/myapp/wsgi.py'

My project directory have the following permission

chown -R apache:developers /home/myproject

chmod -R 755 /home/myproject

I even tried to give 777 permission for the directory and still ended up with the same error message.

Any help would be appreciated

Thanks in advance

Back to Top