Django site doesn't run after machine rebuild using 4.9.0

35 views
Skip to first unread message

Andre Hulet

unread,
Mar 2, 2024, 4:59:08 PM3/2/24
to modwsgi
I run one of my Django sites on my local machine for testing. I recently had to rebuild the machine, and now my site doesn't run (403-you don't have permission to access this resource) even though .conf file settings and file system permissions appear identical. I have a hello world wsgi app that runs fine so long as my Django site is not enabled, in which case the Hello World app returns 404. The only thing different in my setup that I can think of is that I installed mod wsgi 4.9.0 via apt rather than compiling and installing 5.0.

Ubuntu: 22.04
Apache: 2.4.52
wsgi: 4.9.0

I realize this might be an OS permissions issue relating to the rebuild (though I don't see how), but I'm new enough to wsgi to be unsure about my conf file. Here it is. Any suggestions are greatly appreciated.

```
WSGIScriptAlias /discover /data/www/wikidataDiscovery/wikidataDiscovery/wsgi.py
WSGIDaemonProcess wikiframe.local python-home=/data/www/wikidataDiscovery/wd_venv/  python-path=/data/www/wikidataDiscovery/ processes=1 threads=10 display-name=%{GROUP}
WSGIProcessGroup wikiframe.local

ServerName wikiframe.local
ServerAdmin xxx...@yyy.com
DocumentRoot /data/www/
   
Alias /static /data/www/wd_static
Alias /downloads /data/www/wikidataDiscovery/downloads    

<VirtualHost *:80>
  <Location />
    Require all granted
  </Location>

 <Directory /data/www/wd_static>
    Require all granted
  </Directory>

   
    ErrorLog ${APACHE_LOG_DIR}/wikiframe-error.log
  CustomLog ${APACHE_LOG_DIR}/wikiframe-access.log combined

  <Directory /data/www>
    Options FollowSymLinks IncludesNOEXEC
    AllowOverride All
    Require all granted
  </Directory>
 
  <Directory /data/www/wikidataDiscovery>
    AllowOverride All
    Require all granted
  </Directory>
 
    <Directory /data/www/wikidataDiscovery/wikidataDiscovery>
    <Files wsgi.py>
      Require all granted
    </Files>
  </Directory>

</VirtualHost>
``` 

Graham Dumpleton

unread,
Mar 2, 2024, 5:03:49 PM3/2/24
to mod...@googlegroups.com
Keep in mind that if you have a WSGI file in at the location:

/data/www/wikidataDiscovery/wikidataDiscovery/wsgi.py

it is not sufficient that the file /data/www/wikidataDiscovery/wikidataDiscovery/wsgi.py be readable. It is also necessary that all the parent directories down to that location are readable/accessible to the user that Apache runs as.

So check the permissions on:

/data/
/data/www/
/data/www/wikidataDiscovery/
/data/www/wikidataDiscovery/wikidataDiscovery/

as well.

BTW, if you only have one application delegated to a daemon process group, it is best practice to force the use of the main interpreter context of that Python interpreter instance.

So add:

WSGIApplicationGroup %{GLOBAL}

This has nothing to do with the problem, but always a good idea as not all third party Python packages will work in sub interpreters.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/b5acf1c3-9f6c-4855-b6e4-19efa5cb78een%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages