On one of my servers I run a couple sites via Django and recently when I upgraded the server it broke the Django sites that were running via FastCGI. After some investigation I was able to find the issue which happened to be a basic conflict between python2.4 which is the default python version on CentOS Linux and python2.6 which I installed to run via python26 instead of python. This way I can change the environment of any site that needs it to Python version 2.6 without much hassle. Below I describe the error in detail as well as what resolved the issue.
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.
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.
Invalid command ‘FastCGIExternalServer’, perhaps misspelled or defined by a module not included in the server configuration
I got the error below when attempting to configure a Django project to be served by FastCGI via Apache for the first time. I have configured FastCGI but it had been awhile and the server I was working with had ISPConfig installed on it and what I thought to be mod_fastcgi. Below I explain the error, my mix up, and how to resolve on a Linux server.
I recently was installing Django for a test project and needed to upgrade Python on a CentOS server to 2.6. The current revisions available via yum on CentOS are 2.4. The yum package manager requires Python 2.4 still to function properly so upgrading Python to 2.6 manually will break the CentOS yum package manager. After a little bit of research I found a yum repository that would allow you to install Python version 2.6 in parallel to Python version 2.4. Below I explain how to install the new Python version, not break the yum package manager, and modify a Django project that references Python to use the 2.6 version instead of the 2.4 version.