Thanks in advance for your help.
I'm trying to get Django working on Bluehost. Django's admin site is enabled and accessible at http://www.my-domain.com/admin/. However, the whole admin site looks like plain html with no style or images - unlike what I see when using Django's own server (with $ python manage.py runserver
).
After looking around for a solution I tried the following:
- Setting the right values for
STATIC_ROOT
andSTATIC_URL
in my settings.py (see code below). Running:
$ python manage.py collectstatic
(which for some reason seems to copy the files to my project's root folder and not to the static/ folder I specified in settings.py)
Visiting the admin site - still looks like plain html.
Here's an extract from my settings.py file:
import os.path
import sys
# (some more code here)
PROJECT_ROOT = os.path.normpath(os.path.dirname(__ file__))
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
# empty
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
And here's how the .htaccess file in my public_html folder looks:
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} !^/static/
RewriteRule ^(.*)$ my_fcgi_file.fcgi/$1 [QSA,L]
Note the following:
- I don't have access to httpd.conf.
- Whenever I use "python manage.py collectstatic" it copies the files in my project's root folder, not in my project's static folder (which is the folder I specified in
STATIC_ROOT
). I tried copying them manually into this folder, but the admin site still looks like plain html.
Please let me know if you need any additional information.
Any help will be much appreciated :)
Thanks!