Script timed out before returning headers: wsgi.py on elastic beanstalk

后端 未结 6 1140
后悔当初
后悔当初 2020-12-14 07:45

I\'m trying to deploy a Django application to Elastic Beanstalk. When I visit the page it never loads. The logs say:

Script timed out before returning header         


        
6条回答
  •  误落风尘
    2020-12-14 08:21

    UPDATE 8 FEB 2017

    Previously my wsgi.conf was only using one process:

    WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP}

    I upped the processes to something more reasonable and haven't had any issues:

    WSGIDaemonProcess wsgi processes=6 threads=15 display-name=%{GROUP}

    This change along with the original addition of WSGIApplicationGroup %{GLOBAL} seems to have done the trick.

    UPDATE 17 September 2015

    I'm still occasionally running in to this issue. Usually, redeploying via eb deploy fixes the issue. It's hard to say what the underlying issue is.

    Original Answer

    I eventually got the project working but then tried creating an image to use for new instances, which reopened the problem. I'm not sure why it worked then stopped working but I rebuilt my custom AMI from scratch and then repushed my project. Turns out it was an issue in wsgi.py. The version I posted was actually the different from what was being deployed. For some reason another developer had put this in wsgi.py:

    path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    if path not in sys.path:
    sys.path.append(path)
    

    I removed this and it fixed the problem.

    My advice for anyone having

    Script timed out before returning headers: wsgi.py
    

    is to check you wsgi.py file.

提交回复
热议问题