The Python Oracle

Internal Server Error 500 when deploying Django Application to Elastic Beanstalk

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Magical Minnie Puzzles

--

Chapters
00:00 Question
02:08 Accepted answer (Score 1)
03:05 Answer 2 (Score 2)
03:37 Answer 3 (Score 1)
04:07 Thank you

--

Full question
https://stackoverflow.com/questions/5709...

Question links:
https://docs.aws.amazon.com/elasticbeans...

Accepted answer links:
[this documentation]: https://docs.aws.amazon.com/elasticbeans...

Answer 2 links:
[post]: https://stackoverflow.com/questions/3946...
[pull request]: https://github.com/awsdocs/aws-elastic-b...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #django #bash #amazonwebservices #amazonelasticbeanstalk

#avk47



ANSWER 1

Score 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.




ANSWER 2

Score 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.




ACCEPTED ANSWER

Score 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.