title: AWS Beanstalk Django and ReactJS app 504 error when registering
body: <p>I am trying to get a Django REST Framework API with ReactJS as frontend to work on Beanstalk.</p>
  <p>The pages are now showing, however when I try to <code>register</code> I get a <code>504</code> error.</p>
  <p>Looking at the logs:</p>
  <p>/var/log/nginx/error.log</p>
  <pre><code>2022/09/14 15:39:29 [error] 4456#4456: *1127 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.32.240, server: , request: &quot;GET / HTTP/1.1&quot;, upstream: &quot;http://127.0.0.1:8000/&quot;, host: &quot;django-env1.eba--.us-west-2.elasticbeanstalk.com&quot;
  </code></pre>
  <p>/var/log/web.stdout.log</p>
  <pre><code>Sep 15 10:51:30 ip-172-31-29-189 web: Traceback (most recent call last):
  Sep 15 10:51:30 ip-172-31-29-189 web: File &quot;/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/db/backends/base/base.py&quot;, line 244, in ensure_connection
  Sep 15 10:51:30 ip-172-31-29-189 web: self.connect()
  Sep 15 10:51:30 ip-172-31-29-189 web: File &quot;/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/utils/asyncio.py&quot;, line 26, in inner
  Sep 15 10:51:30 ip-172-31-29-189 web: return func(*args, **kwargs)
  Sep 15 10:51:30 ip-172-31-29-189 web: File &quot;/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/db/backends/base/base.py&quot;, line 225, in connect
  Sep 15 10:51:30 ip-172-31-29-189 web: self.connection = self.get_new_connection(conn_params)
  Sep 15 10:51:30 ip-172-31-29-189 web: File &quot;/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/utils/asyncio.py&quot;, line 26, in inner
  Sep 15 10:51:30 ip-172-31-29-189 web: return func(*args, **kwargs)
  Sep 15 10:51:30 ip-172-31-29-189 web: File &quot;/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/db/backends/mysql/base.py&quot;, line 244, in get_new_connection
  Sep 15 10:51:30 ip-172-31-29-189 web: connection = Database.connect(**conn_params)
  Sep 15 10:51:30 ip-172-31-29-189 web: File &quot;/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/MySQLdb/__init__.py&quot;, line 123, in Connect
  Sep 15 10:51:30 ip-172-31-29-189 web: return Connection(*args, **kwargs)
  Sep 15 10:51:30 ip-172-31-29-189 web: File &quot;/var/app/venv/staging-LQM1lest/lib64/python3.8/site-packages/MySQLdb/connections.py&quot;, line 185, in __init__
  Sep 15 10:51:30 ip-172-31-29-189 web: super().__init__(*args, **kwargs2)
  Sep 15 10:51:30 ip-172-31-29-189 web: MySQLdb.OperationalError: (2013, &quot;Lost connection to MySQL server at 'reading initial communication packet', system error: 0&quot;)
  </code></pre>
  <p>I am trying to read up on what needs to be fixed for these errors, this is my first time trying to get an app onto Beanstalk.</p>