Jon Rubins
Jon Rubins

Reputation: 4413

STATIC_URL Problems

Static files with Django are driving me insane. I'm successfully able to load my template from the directory specified in TEMPLATE_DIRS, but when I try to load my css and js files from the STATICFILES_DIRS it doesn't work.

Below are the relevant parts of my settings.py file:

MEDIA_ROOT = ''
MEDIA_URL = ''

STATIC_ROOT = ''

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    '/home/jrubins/Documents/crowdcluster/crowdcluster/Design/websiteDesign/website/',
)

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
    'django.core.context_processors.static',
    'django.contrib.auth.context_processors.auth',
    'django.contrib.messages.context_processors.messages',
)

TEMPLATE_DIRS = (
    '/home/jrubins/Documents/crowdcluster/crowdcluster/Design/websiteDesign/website/',
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'items'
)

Please let me know if you need more info or if you see something wrong. Thanks in advance.

Upvotes: 1

Views: 160

Answers (2)

Jon Rubins
Jon Rubins

Reputation: 4413

Looks like I didn't add RequestContext in my render_to_response() in my view. Solved the problem and should have looked closer at the django documentation.

Upvotes: 1

Chris Frank
Chris Frank

Reputation: 4442

I am having the same problem, but I found this website which has a lot of information that might be able to help http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/

Upvotes: 0

Related Questions