title: Error Deploying Django App on Elastic Beanstalk
body: <p>I'm trying to deploy my Django app on elastic beanstalk. It is saying that it is deployed, but the health immediately turns red and I see &quot;502 Bad Gateway / Nginx&quot; when I try to go to the site. I know there are other answers to this question on stack overflow, but I am still stuck.</p>
  <p>In my logs I see <code>web: ModuleNotFoundError: No module named 'mysite.wsgi'</code>.</p>
  <p>In my file <code>repos/mydjangoproject/mysite/.ebextensions/django.config</code>
  I have</p>
  <pre><code>  aws:elasticbeanstalk:application:environment:
      DJANGO_SETTINGS_MODULE: &quot;core.settings&quot;
      PYTHONPATH: &quot;/var/app/current:$PYTHONPATH&quot;
    aws:elasticbeanstalk:container:python:
      WSGIPath: mysite.wsgi:application
  </code></pre>
  <p>And I have a file:
  <code>repos/mydjangoproject/mysite/mysite/wsgi.py</code>
  Which contains</p>
  <pre><code>import os
  from django.core.wsgi import get_wsgi_application
  os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
  application = get_wsgi_application()
  </code></pre>
  <p>I also am seeing these errors</p>
  <pre><code>2022/07/04 01:57:50 [error] 3507#3507: *536 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.22.27, server: , request: &quot;GET / HTTP/1.1&quot;, upstream: &quot;http://127.0.0.1:8000/&quot;, host: &quot;44.241.154.93&quot;
  2022/07/04 01:57:50 [error] 3507#3507: *536 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.22.27, server: , request: &quot;GET /blog/wp-includes/wlwmanifest.xml HTTP/1.1&quot;, upstream: &quot;http://127.0.0.1:8000/blog/wp-includes/wlwmanifest.xml&quot;, host: &quot;44.241.154.93&quot;
  </code></pre>
  <p>I have gunicorn installed and in my requirements.txt.</p>
  <p>I am using 'Python 3.8 running on 64bit Amazon Linux 2/3.3.14', Django==4.0.1, and gunicorn==20.1.0.</p>
  <p>Any thoughts on what I might be doing wrong would be appreciated!</p>