1

I'm getting an error when running my Django app with gunicorn: when I make a post request over 7800 bytes I see the following error from gunicorn:

"Error opening file for reading: Permission denied".

It then drops the request and nginx is getting a "Connection reset by peer" error.

This doesn't happen if I run the Django development server instead. Strangely, if I make the request to an invalid URL, no matter what the post content length, I get the standard Django debug webpage.

So it seems to be how gunicorn is handling something that Django is doing when it's processing a request for a valid view URL.

This is being run on Ubuntu 12.04. I've tried running Gunicorn as root and it still happens.

I'm at a bit of a loss on how to debug this any further. I've tried setting the tmp_upload_dir to a directory will full permissions incase that was an issue, but no luck.

Any advice would really be appreciated.

0

1 Answer 1

0

You need to allow the host in the ALLOWED_HOSTS in your settings.py

ALLOWED_HOSTS = (
    'stage.domain.com',
    'domain.com',
)

I would expect a more descriptive error message, but unfortunately, this is what we get.

3
  • I don't think it's this because I'm running with DEBUG=True Sep 9, 2013 at 21:46
  • It's not a production server, just another development machine running gunicorn. Sep 9, 2013 at 21:47
  • yeah this didn't fix it for me either, I had the proper allowed hosts in there already. What did it was running chown -R my_id:my_gid * on my entire django project. It should be the same user/group used to run gunicorn i.e. --user --group in your conf file, or by default its the user you are logged in as.
    – radtek
    Aug 6, 2014 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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