Django 1.4 Static Files Problems And Don't Render At Other Urls Of My Project
Solution 1:
First of all, the following does not fix your problem because STATIC_URL should contain /static/, you don't want to write it yourself anywhere:
"{{ STATIC_URL }}static/css/reset.css"Now, if you have {{ STATIC_URL }} in your template but the /static/ does not show up in the templates then I think you're missing the template context processor for STATIC_URL.
Add 'django.core.context_processors.static' to your TEMPLATE_CONTEXT_PROCESSORS setting. For example, like this:
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.static',
)
If TEMPLATE_CONTEXT_PROCESSORS is in your settings file already then you should add it to what's already there.
Also, note that STATIC_URL ends in a slash so you'll need to remove the first slash after {{ STATIC_URL }} here:
<link rel="stylesheet"type="text/css" href="{{ STATIC_URL }}/css/reset.css" />
Lastly, your STATIC_ROOT is most likely not what you intended. It should be:
"/home/tony/Documents/mysite/mysite/static/"This is the location where the static files will be placed when you run the collectstatic command. See Managing static files in the Django documentation.
Solution 2:
You're not using RequestContext to render your template, so the context processors aren't being run and therefore STATIC_URL is empty.
Post a Comment for "Django 1.4 Static Files Problems And Don't Render At Other Urls Of My Project"