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 http://www.foreignlanguageflashcards.com/django/test1/admin/ Thanks.


With some help from http://blog.ruedaminute.com/2011/01/2011-installation-instructions-for-django-on-bluehost/ 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 http://www.foo.com/django/project/static/admin/media/ (part of my problem earlier was confusing the django project directory with the public url directory)
  2. edited settings.py 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")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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