Kevin Li
Kevin Li

Reputation: 1

Django runs successfully at localhost but 500 on AWS EB

I just tried writing a simple Django application hosted on AWS Elastic Beanstalk. I can run the server successfully on my localhost. However, when I deploy it on EB, it failed with an 500 error.

Here is my project tree

.   
├── README.md   
├── db.sqlite3   
├── djangosite   
│   ├── __init__.py   
│   ├── settings.py   
│   ├── urls.py   
│   └── wsgi.py   
├── intro   
│   ├── __init__.py   
│   ├── admin.py   
│   ├── apps.py   
│   ├── migrations   
│   │   └── __init__.py   
│   ├── models.py   
│   ├── tests.py   
│   └── views.py   
├── manage.py   
├── requirement.txt   
└── templates   
    └── index.html

I didn't find the log with the correct time in the logs. Usually 500 means there may be something wrong with my codes. But it runs well if I start the server locally

$ python manage.py runserver

I tried to us eb ssh to login the instance and find there is no django in /opt/current/app where my codes sit.

But I truly add Django==1.9.8 to requirement.txt. It seems eb do not installed django. It is also not in /opt/python/run/venv/lib/python2.7/site-packages/.

Upvotes: 0

Views: 808

Answers (1)

DA--
DA--

Reputation: 765

(I don't have enough reputation to comment)

I'm assuming that you're application starts at all on the production server(you don't mention whether is does).

Did you change Debug=False on the production server? Then uncaught exceptions in cause a 500 response. While having Debug=True in development(locally) returns you the Debug screen.

Upvotes: 1

Related Questions