Andrew
Andrew

Reputation: 4441

Django Elastic Beanstalk Deploy showing 404

I'm attempting to deploy my first Django app to Elastic Beanstalk. The Beanstalk created successfully via command line tools, I uploaded from my Mercurial via ZIP, that seemed to work just fine. But I'm getting a 404 when attempting to access it.

Elastic Beanstalk HTTP Error (the log is huge, I can parse more, but I only see this for an error)

[Fri Jan 03 18:08:26 2014] [error] [client 127.0.0.1] Target WSGI script not found or unable to stat: /opt/python/current/app/application.py

WSGI Settings for the Django app

wsgi.py

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "company.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

settings.py

WSGI_APPLICATION = 'company.wsgi.application'

This works fine locally and I'm sure I'm just not understanding something that I should be.

Please help!

Folder structure:

 /opt/python/current/app/

  - company
     - static
     - templates
     - wsgi.py
     - settings.py
     - __init__.py
     - urls.py

  - webapp
     - templates
  - manage.py
  - requirements.txt

Upvotes: 11

Views: 8022

Answers (1)

kukido
kukido

Reputation: 10601

AWS Elastic Beanstalk's default configuration sets WSGIPath to application.py, you either need to rename your file with mappings to application.py or configure the environment to point to your mappings script.

Detailed information can be found in AWS Elastic Beanstalk Python Container Options: Option Values

You can set it with the management console

enter image description here

Or with .ebextensions option_settings

NB: It should be relative path.

Upvotes: 6

Related Questions