Django AWS Elastic Beanstalk WSGIPath refers to a file that does not exist
Asked Answered
P

1

6

I've tried everything suggested so far but nothing seems to work. I've created a new Django project with Cookiecutter. I'm able to run it locally and via my Docker machine but for some reason I can't get it to deploy to AWS. I've also been following along this documentation loosely:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html#python-django-configure-for-eb

.ebextensions/django.config

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: config/wsgi.py

Project Structure

~/project
|-- .ebextensions
|-- `-- django.config
|-- .elasticbeanstalk
|-- `--config.yml
|--config
|-- | ...
|-- | wsgi.py
|-- project
|-- manage.py

When I check the logs, this is a sample of what I get:

Target WSGI script not found or unable to stat: /opt/python/current/app/application.py

When I run eb config I get these settings:

  aws:elasticbeanstalk:container:python:
    NumProcesses: '1'
    NumThreads: '15'
    StaticFiles: /static/=static/
    WSGIPath: application.py

I've tried editing this, moving the wsgi.py file, renaming it, but nothing works. What am I doing wrong?

Premillennial answered 28/4, 2016 at 4:45 Comment(2)
The only different with mine is the file format. Here is my file: github.com/dkarchmer/django-aws-template/blob/master/server/… But check the content of the wsgi.py and manage.py and compare them with mine. You can always just add an application.py insteadShelly
thanks @dkarchmer. My manage and wsgi are similar to yours. When you say add application.py, does that just mean copy and paste the contents of my wsgi.py file and save them to the application.py file? And if so, is the application.py file mean to be saved at root?Premillennial
S
4

The problem for me was that I made code changes but I didn't commit them. When I tried to deploy to elastic beanstalk with eb deploy, it was deploying my old code which had reference to application.py instead of myproject/wsgi.py

Sweatband answered 12/9, 2016 at 16:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.