My static files aren't being served correctly because there's a strange space in my folder structure.
development folder structure
static >css >lots of css files >js >img
When I run collecstatic to serve them properly, collect static puts everything into a folder called staticfiles, here's my settings.py
STATIC_DIR = os.path.join(BASE_DIR,'static') MEDIA_DIR = os.path.join(BASE_DIR, 'media') STATICFILES_DIRS = [ STATIC_DIR ] STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR,'staticfiles/static') # MEDIA file defaults MEDIA_ROOT = os.path.join(BASE_DIR,'staticfiles/media') MEDIA_URL = '/staticfiles/media/'
I use it this way as this is how its configured on my live server. I now have (in my development env) a folder in the project called staticfiles/static, inside which I can find the a similar folder structure as above.
staticfiles >img >media >static >css >admin >img >podcast >js
However, once I've run the server, django thinks my CSS file 'static/%20css/front.css' and so it doesn't load. If I correct the URL to 'static/css/front.css' the css file loads perfectly...?
Here's where it's trying to get the css from: http://127.0.0.1:8000/static/%20css/front.css
Here's where it actually is: http://127.0.0.1:8000/static/css/front.css
I've checked the folder name for 'css' on both my development static, and the staticfiles static, and it is correct. It seems to be something to do with the way it's written the folder path?