My static files aren't being served correctly because there's a strange space in my folder structure.

development folder structure

  >lots of css files

When I run collecstatic to serve them properly, collect static puts everything into a folder called staticfiles, here's my

STATIC_DIR = os.path.join(BASE_DIR,'static')
MEDIA_DIR = os.path.join(BASE_DIR, 'media')

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.


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:

Here's where it actually is:

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?

0 Answers