Deploying Django to AWS - WSGIPath refers to a file that does not exist

17,518

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

Share:
17,518
rcca
Author by

rcca

Updated on June 11, 2022

Comments

  • rcca
    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
    Zoe stands with Ukraine over 5 years
    A 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
    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
    TheGrimmScientist about 5 years
    this 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
    user1790399 about 4 years
    Wow, 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
    Şafak Çıplak about 4 years
    i'm still get same error "Your WSGIPath refers to a file that does not exist."
  • Josh
    Josh about 4 years
    You 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
    AlxVallejo almost 4 years
    Why are you using forward slash syntax and not dot syntax?
  • Josh
    Josh almost 4 years
    @AlxVallejo the forward slash is just the directory of your App
  • Neil
    Neil almost 4 years
    Thank 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 did eb deploy and got this error.
  • Adam
    Adam over 3 years
    If 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.