Setting up Django on AWS Elastic Beanstalk: WSGIPath not found
Find .elasticbeanstalk/optionsettings.your-app-name
in your app's root directory. Search for WSGIPath
and make sure it's the path you intend. It looks like it defaults to application.py
.
Solution: using EBCLI
open eb config
For me it showed WSGIPath: application.py
Now Change it to
WSGIPath: my_app/wsgi.py
save and deploy.
From https://forums.aws.amazon.com/thread.jspa?messageID=396656񠵰
The ".ebextensions" directory must be in the root level directory of your application, but from the log output, the directory is instead in the "mysite/.ebextensions" directory. So for example, after following the django tutorial in the docs when you run "git aws.push" your root directory would look like this:
.
├── .ebextensions
│ └── python.config
├── .elasticbeanstalk
│ ├── config
├── .git
├── .gitignore
├── manage.py
├── mysite
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
└── requirements.txt
Instead of this:
.
└── mysite
├── .ebextensions
├── .elasticbeanstalk
├── .git
├── .gitignore
├── manage.py
├── mysite
└── requirements.txt
I had the same problem ("Your WSGIPath refers to a file that does not exist"), and finally found a solution:
- The problem: I was downloading the bundle of the project directly from GitHub ("Download Zip"), which maybe had an improper structure.
- The solution: I properly zip the files, without the main folder, using the Compress command. (cf http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.deployment.source.html).
Note: At first, I was searching in the wrong direction, because EB was also showing this message: Error occurred during build: Command 01_migrate failed.. So I though the files, including the *.config, were correctly located.