Before now, the main domain was serving a WordPress website but I needed to replace that with a new django application.
I was able to successfully deploy the Django application to cPanel, and the application was served on a subdomain without any problems. But when I edit the application url to point to the main domain, the homepage renders without the static files. Initially, I thought it was a static file issue until I tried to access other pages, but all I keep getting is a 404 page that is being served by the old WordPress. Somehow the old wordpress website is conflicting with the django app.
I'm not sure why the old wordpress is still trying to serve the new django pages except the homepage, even though static files are also missing on the homepage.
I figured out that it was the wordpress installation that was interfering with the Django application, so I renamed the wordpress index.php file, and everything works now. This means that the problem is not with the Django configuration but with the fact that a WordPress website was running on that domain before.
Changing the index.php file name fixed it; I could have deleted all the WordPress files and folders and it would still work, but since I still want to keep the files, renaming the index.php means that WordPress won't be able to load the file.