Question

I'm using django 1.3.1 and in my application and I have set DEBUG = False in my settings.py. when I refresh the page, the url is going into some loop process and in every loop a slash is being appended to the static files and due to this no static files are being called. I have pasted a sample terminal output below. What could be reason and how can I resolve this?

[30/Mar/2013 11:57:30] "GET /static/img/admin/logo.jpg//////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:30] "GET /static/img/admin/logo.jpg///////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:30] "GET /static/img/admin/logo.jpg////////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:30] "GET /static/img/admin/logo.jpg/////////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:30] "GET /static/img/admin/logo.jpg//////////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:30] "GET /static/img/admin/logo.jpg///////////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:30] "GET /static/img/admin/logo.jpg////////////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:30] "GET /static/img/admin/logo.jpg/////////////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:30] "GET /static/img/admin/logo.jpg//////////////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:31] "GET /static/img/admin/logo.jpg///////////////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:31] "GET /static/img/admin/logo.jpg////////////////// HTTP/1.1" 301 0
[30/Mar/2013 11:57:31] "GET /static/img/admin/logo.jpg/////////////////// HTTP/1.1" 301 0

This works fine when I set DEBUG = True in my settings.py.

Was it helpful?

Solution

After a little search, I found this question very helpful. Why does DEBUG=False setting make my django Static Files Access fail?

With debug turned off Django won't handle static files for you any more - your production web server (Apache or something) should take care of that.

If you still need to server static locally (e.g. for testing without debug) you can run devserver in insecure mode: manage.py runserver --insecure

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top