Django's handling of static files continue to be slightly confusing, particularly in terms of the naming of relevant settings.
The short answer is to move your static files; instead of
/home/wayne/programming/somesite/static
put them in
/home/wayne/programming/somesite/yourapp/static
(where "yourapp" is obviously the name of your main application).
The longer answer is that I think you've (understandably) become confused about the various settings. STATIC_ROOT
only refers to the location where your static files should end up after running manage.py collectstatic
. You don't need this set (as you shouldn't really need collectstatic
) when developing locally. Either way, STATIC_ROOT
should always refer to an empty directory.
Your STATICFILES_DIRS
setting would almost work, except that you've told Django there are two paths where it should find static files
/home/wayne/programming/somesite/static/styles
/home/wayne/programming/somesite/static/admin
so when you do {% static "styles/main.css" %}
it will look for
/home/wayne/programming/somesite/static/styles/styles/main.css
/home/wayne/programming/somesite/static/admin/styles/main.css
and will obviously not find them. What might work is
STATICFILES_DIRS = ('/home/wayne/programming/somesite/static',)
but there's no need to do that, as you can just rely on django.contrib.staticfiles.finders.AppDirectoriesFinder
(in the default STATICFILES_FINDERS) and move your static files to an app directory.
Hope this clears things up a little.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…