Django project crashes server when admin backend is accessed


I am running apache2 on my local ubuntu server. I set up a Django project using django-admin startproject site and set up my virtual host to use a WSGI Daemon process to run the Django project. This worked and the site is accessible through its IP

When I go to /admin, it allows me to log in and see the initial backend but loads for 5 minutes then goes to a 500 error when I click anything or reload, even when trying to access the non-admin index page. This persists until I run systemctl restart apache2 and completely restart apache or wait ~10-15 minutes until it fixes itself (only to break again immediately if I access /admin pages).


Django version 4.1.5

mod-wsgi version 4.9.4

My Attempts

If I run the project with python runserver, I can access it on and fully use the /admin backend, even creating new users, etc. I then thought it was the WSGI Daemon process somehow messing it up, so I followed the linked section of this page: and ran the site with python runmodwsgi. The site completely works on along with the /admin, and I can create new users etc., which points to it having nothing to do with the WSGI setup (as well as the non-admin pages working fine on the virtual host WSGI).

I have fully deleted and restarted the Django project, as well as setting up new virtual host .conf files with the proper WSGI information, etc.

I read about an /admin loading issue back in Django 3.0, but I am on 4.1 so that is unrelated.

I am at a complete loss at what the issue could be at this point. Why won't my /admin section work on the virtual host??

I found the solution. Somehow during the whole setup, adding WSGIApplicationGroup %{GLOBAL} to the /etc/apache2/apache2.conf file was never recommended, at least not that I noticed, but it worked and all the admin functionality works on the virtual host through WSGI Daemon.

Hope this can help someone else.

Back to Top