[Answered ]-Custom static files not loading in django project

1๐Ÿ‘

โœ…

I had been using static files at the project level and not the app level. Any new static file, I was directly adding to the static directory which was my static root as well. Now as per this answer,
https://stackoverflow.com/a/12161409/5379191 ,

"Your STATIC_ROOT directory should be empty and all static files should be collected into that directory (i.e., it should not already contain static files)".
So, the main thing was that it should not already contain the static files.

I created a new staticfiles folder in the project level directory, shifted my custom static files to that directory, ran the collectstatic command, and then boom it worked.
So, the main thing here to remember is not to directly place your static files in the static root dircetory but rather let the collectstatic do its job.

๐Ÿ‘คKush

0๐Ÿ‘

Adding this worked for me:

MEDIA_URL = โ€˜/static/images/โ€™

๐Ÿ‘คdileepvarma

Leave a comment