Django static files, not all files visible

[mod edit] This question is largely outdated since we released our static files support, which you'll find on the Web tab


I defined STATIC_ROOT in Django project to point to a directory. Many of the files in the folder is accessible but some raise 404 error. Anyone has any idea why?

I can access this file at

-rw-rw-r-- 1 65432 registered_users 4740 May 2 2010 actions.js

But access to this file fails.

-rw-rw-r-- 1 65432 registered_users 233435 Aug 2 22:20 d3v2.js

Both files are in the same directory. Why one file success but another file fail?

That's rather strange, I really can't think why that might happen. You've checked permissions already...

One thing you could try is: there is a secret, undocumented feature, where if you put files into /var/www/static, they get served automatically... You could try copying things in there?

Only thing I can think of is whether there's a stray nginx configuration rule matching the filenames somehow. If you try renaming a working file over the top of a broken one (making sure you have a copy first, of course!) then does that renamed file work or not? That should at least determine whether it's the file name or content/size which is causing an issue.

Thanks, Harry and Cartroo.

It's strange indeed. I cannot access this file today. It was accessible yesterday...

I tried re-naming the file but no success.

For /var/www/static, at which address the files in this folder become visible? ??

Actually I configured Django to serve static files at Is it conflicting with this secret feature?

Hmm, interesting point about the conflict - perhaps try renaming it something other than "static" just to see? I'm no expert in either nginx or the PAW configuration of it, but it strikes me as something easy to check.