Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer
    
I don't think it's this because I'm running with DEBUG=True –  Michael Waterfall Sep 9 '13 at 21:46
    
It's not a production server, just another development machine running gunicorn. –  Michael Waterfall Sep 9 '13 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 at 20:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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