Technology Insights

Django Media Files Not Displaying In Apache Using FastCGI

I got stuck trying to display the Django media files from a Django project served using FastCGI configured in Apache. I thought for sure that the issue must be something with Apache so I tried a ton of different configuration variables. I wanted to share in case anyone else runs into the CSS and image files not showing up for the Django admin site. If the admin login to your Django project does not look similar to the below then the media files are not being loaded properly.

Code Snippets

Init Script To Run Django FastCGI Threaded On A TCP Port

I have been messing around with Django over the past week and experimenting with various settings. I first ran Django using mod_ptyhon from Apache but the results were unimpressive. Apache served the Django project’s pages extremely slow using the Apache mod_python module. After some reading I decided to give the Apache mod_fastcgi module a try to see if the results were any better. I was definitely happier with the web page load time so I then decided to experiment with various FastCGI settings.