[Django]-Internal Server Error 500 when deploying Django Application to Elastic Beanstalk

1👍

I was trying to deploy my Django Rest Api to Beanstalk by following this documentation. And I encountered the same Status Code 500 error.

I managed to solve this problem by making below two changes:

  1. AWS Beanstalk’s python 3.6 environment doesn’t seem to work well with latest Django versions. So I created a new python 3.7 environment using this command.

    eb init -p python-3.7 django-tutorial
    
    
  2. Changed WSGI Path to:

    WSGIPath: YourDjangoProjectFolder.wsgi:application

All other things are same as described in that documentation.

2👍

Did you resolve it? I struggled for weeks but with a 502 after following exactly the instructions.

Then I found this post and deduced it was a typo or outdated instructions (*/wsgi.py should be *.wsgi:application).

Created a pull request to AWS docs and they’ve updated since.

1👍

I was having the same problem, until I realized I hadn’t included the following line in my settings.py file:

ALLOWED_HOSTS = ['eb-django-app-dev.elasticbeanstalk.com'] 

Replacing the link inside the brackets with my own custom application link, as stated in step 5 of the tutorial.

After saving the file and committing, I was able to get rid of the 500 error.

Leave a comment