Deploying Django to AWS - WSGIPath refers to a file that does not exist
Solution 1
One thing I found when I encountered this error, is that if your repository is a git repository your .ebextensions folder must be tracked and committed otherwise it will not be picked up properly on eb deploy.
Solution 2
Using eb
:
eb config
Go to aws:elasticbeanstalk:container:python:
and change WSGIPath from:
application.py
to
mysite/wsgi.py
With "mysite" being your application name ofcourse
Solution 3
possible solution error : Your WSGIPath refers to a file that does not exist
after following this tutorial: https://realpython.com/deploying-a-django-app-to-aws-elastic-beanstalk/
I got the error when I was uploading my protect to aws. The step that I forgot was to activate my virtual env and from my there type the command 'eb deploy'
note : this error can also occur in different circumstances
rcca
Updated on June 11, 2022Comments
-
rcca almost 2 years
I've been struggling with getting Django and AWS to work together. I'm following the tutorial here:
https://realpython.com/blog/python/deploying-a-django-app-to-aws-elastic-beanstalk/
I've been following all the tutorial steps, including using the "eb option" command to change the WSGIPath, but I keep getting the error:
"ERROR: Your WSGIPath refers to a file that does not exist."
As far as I can tell I've been doing everything exactly according to the tutorial.
The relevant part of my config file looks like this:
NumProcesses: '1' NumThreads: '15' StaticFiles: /static/=static/ WSGIPath: iotd/iotd/wsgi.py
What am I doing wrong?
-
Zoe stands with Ukraine over 5 yearsA link to a solution is welcome, but please ensure your answer is useful without it: add context around the link so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. Answers that are little more than a link may be deleted.
-
dbc over 5 years@Zoe - Not sure this is a link-only answer, since the answer specifically indicates the step necessary to resolve the problem.
-
TheGrimmScientist about 5 yearsthis this this. I had to re-discover this twice now. Odd that I don't see it in docs anywhere, unless it's somehow not seen as common to use git along with your server code deopled EB? Odd
-
user1790399 about 4 yearsWow, nice catch! The same is true for requirements.txt file. I never would have guessed this as the issue. The documentation page redirects you to the "Using EB CLI with git" page but it's not very clear that requirement.txt needs to be in the git repository as well.
-
Şafak Çıplak about 4 yearsi'm still get same error "Your WSGIPath refers to a file that does not exist."
-
Josh about 4 yearsYou should have a wsgi.py file in your main app i.e. where you settings.py file is located. Use that path. If you don't have the wsgi then that is your problem...
-
AlxVallejo almost 4 yearsWhy are you using forward slash syntax and not dot syntax?
-
Josh almost 4 years@AlxVallejo the forward slash is just the directory of your App
-
Neil almost 4 yearsThank you so much! I was stuck on this. I figured it had to be git because that was the only thing I changed. I did
git init
, specified.ebextensions
within.gitignore
, then dideb deploy
and got this error. -
Adam over 3 yearsIf you following the tutorial at docs.aws.amazon.com/elasticbeanstalk/latest/dg/… and getting this error, then this is the solution as of right now.