7

I got 500 from Django admin, when I tried to upload a photo.

When I inspect the error.log I found:

2014/03/13 23:00:55 [crit] 16478#0: *24 open() "/var/lib/nginx/tmp/client_body/0000000012" failed (13: Permission denied), client: xxxxxxx.xxx, server: xxxxxxx.xxx, request: "POST xxxxxxx.xxx/item/86/ HTTP/1.1", host: "xxxxxxx.xxx", referrer: "http://xxxxxxx.xxx/item/86/"
------------------------------------------------------------------------

What could be wrong here?

3
  • If you are using django >= 1.5, try setting the ALLOWED_HOSTS
    – karthikr
    Mar 13, 2014 at 15:23
  • @karthikr Thanks! It's already set as the server's ip. If I edit the text, everything work. Only uploading photo gives 500.
    – noooooooob
    Mar 13, 2014 at 15:30
  • Related question: stackoverflow.com/a/69504680/5117552
    – Ryan Lyu
    Oct 9, 2021 at 14:45

1 Answer 1

6

Phew. Solved. As the error message says, this indeed was just a "Permission" issue.

Check through "/var/lib/nginx/tmp/client_body/" and make sure the permission is correct at each directory level solve the issue.

More details can be found here : http://derekneely.com/2009/06/nginx-failed-13-permission-denied-while-reading-upstream/ and here : Permission Denied error with Django while uploading a file

4
  • does restarting django recreate the issue? or was it a one time thing ? Mar 15, 2014 at 11:27
  • @MohammadAbuShady Hi. I don't quite understand your question. Restarting Django made no difference in my case.
    – noooooooob
    Mar 16, 2014 at 15:53
  • was just asking if the permission issue was a one time thing or was it being reproduced with each django restart Mar 16, 2014 at 16:01
  • @MohammadAbuShady It's one time thing.
    – noooooooob
    Mar 17, 2014 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.