14
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
8
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
.
- [Django]-Should every django app within a project have it's own urls.py?
- [Django]-Better option to check if a particular instance exists django
- [Django]-How to pass a message from HttpResponseRedirect in Django?
3
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.
- [Django]-Django, redirect all non-authenticated users to landing page
- [Django]-Django Rest Framework 'RelatedManager' object has no attribute
- [Django]-Django urls straight to html template
3
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.
- [Django]-Django β Rotating File Handler stuck when file is equal to maxBytes
- [Django]-Django "Remember Me" with built-in login view and authentication form
- [Django]-Django form with choices but also with freetext option?
2
Ok, hereβs what worked for me after trying a million things. You have to run eb update
in order to update the environment.
So make sure .elasticbeanstalk/optionsettings.whatever-env
has WSGIPath set to what you want it, and make sure .ebextensions/whatever.config
has this:
option_settings:
- namespace: aws:elasticbeanstalk:container:python
option_name: WSGIPath
value: whatever/wsgi.py
Then run eb update
and it should work. Remember you have to set the alias to make sure your eb
command actually works. For example:
alias eb="python2.7 ../AWS-ElasticBeanstalk-CLI-2.6.3/eb/linux/python2.7/eb"
- [Django]-Django β Class Based Generic View β "No URL to redirect to"
- [Django]-Django :How to integrate Django Rest framework in an existing application?
- [Django]-Writing unit tests in Django / Python
2
I had the same issue after following AWSβs docs to the dot. What I did to avoid it was initialize an application through the EB CLI step by step, without using the command the AWS docs instructed (~/ebdjango$ eb init -p python2.7 django-tutorial), and creating an environment step by step as well. The steps I took in the EB CLI are the following:
- Initialize Application
eb init
- Select a default region
- Enter Application Name (used default by pressing enter)
- Confirmed that I am using Python
- Selected Python version compatible with my local environment
- Set up SSH
- Create Environment
eb create
- Enter Environment Name (used default by pressing enter)
- Enter DNS CNAME prefix (used default by pressing enter)
- Select a load balancer type (I selected classic by entering 1)
After Environment is created I use eb config
to open EBβs config file to confirm that the path to my WSGI is what it should be:
aws:elasticbeanstalk:container:python:
NumProcesses: '1'
NumThreads: '15'
StaticFiles: /static/=static/
WSGIPath: path/to/wsgi.py
If any changes are made, make sure you save the file and confirm that everything is squared up by entering eb open
in your terminal to open a browser window using the domain name specified in previous steps.
- [Django]-Django catch-all URL without breaking APPEND_SLASH
- [Django]-What is more efficient .objects.filter().exists() or get() wrapped on a try
- [Django]-Implementing multiple user types with Django 1.5