Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have set up Django 1.3 onto my BlueHost account with Python 2.6 and it is working well except when I enter the admin area it is void of any css/formatting - all I get is text. In my research I found that I need to set up the web server to 'serve' the static files, Django does not do this (except when using the Django development server).

I have made several attempts but no success... Here are the current settings:

ADMIN_MEDIA_PREFIX = '/static/admin/'


AddHandler fcgid-script .fcgi
RewriteEngine On
Rewritebase /
RewriteRule ^(static/admin/.*)$ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /django/test1/mysite.fcgi/$1 [QSA,L]

There is also a symlink at the projects static files ../static/admin/ to ../django/contrib/admin/media

You can see the resulting page at Thanks.

share|improve this question

migrated from May 27 '11 at 22:14

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

With some help from I was able to get it working. I gave up on using symlinks and:

  1. copied the admin media files from /.local/lib/python2.6/site-packages/django/contrib/admin/media to (part of my problem earlier was confusing the django project directory with the public url directory)
  2. edited to include: ADMIN_MEDIA_PREFIX = '/django/project/static/admin/media/'
  3. cleaned up the htaccess to look like:
AddHandler fcgid-script .fcgi
RewriteEngine On
Rewritebase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /django/project/mysite.fcgi/$1 [QSA,L]
  1. If it helps, here is the fcgi script:
import sys, os
# Add a custom Python path.
sys.path.insert(0, "/home1/username/.local/lib/python2.6")
sys.path.insert(0, "/home1/username/django_projects")

# Switch to the directory of your project. (Optional.)
# os.chdir("/home1/username/django_projects/project") 

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.