user2492364
user2492364

Reputation: 6713

Amazon Elastic Beanstalk : how to set the wsgi path?

I practice set up Django under Elastic Beanstalk from there document. But There is error.

ERROR   Your WSGIPath refers to a file that does not exist.

My directory like this:

-djangoenv (where I use git)
     - mysite 
          -manage.py
          -mysite 
              -__init__.py 
              -settings.py
              -urls.py
              -wsgi.py

and My the .elasticbeanstalk/optionsettings.djapp file like this :

enter image description here

And .ebextensions/python.config like this , I don't know where to put this .try several times still not work . I try mysite/mysite/wsgi.py still not work

container_commands:
  01_syncdb:    
    command: "django-admin.py syncdb --noinput"
    leader_only: true

option_settings:
  - namespace: aws:elasticbeanstalk:container:python
    option_name: WSGIPath
    value: mysite/wsgi.py
  - option_name: DJANGO_SETTINGS_MODULE
    value: mysite.settings

Please tell me how and where to set my wsgi path ??

Thank you very much!

Upvotes: 7

Views: 9913

Answers (5)

user3176961
user3176961

Reputation: 1

You should try mysite.wsgi:application and make sure you are in the mysite first folder while deploying your application

Upvotes: 0

shivangg
shivangg

Reputation: 601

The path specified should be relative to the .elasticbeanstalk directory. The correct path should be mysite/mysite.wsgi.py. option_settings: is:

option_settings:
  - namespace: aws:elasticbeanstalk:container:python
    option_name: WSGIPath
    value: mysite/mysite/wsgi.py
  - option_name: DJANGO_SETTINGS_MODULE
    value: mysite.settings

Upvotes: 5

Zhang Ran
Zhang Ran

Reputation: 316

In the server you are about to deploy the django application to elasticbean stalk. Run:

eb config

Then replace the application.py to mysite/wsgi.py and save the changes.

After the update, you may do:

git add. git commit -m "some updates" eb deploy

After successfully update the environment, you may view the changes in elasticbeanstalk, under your enviroment, go to the instance and check the setting in Configuration, then view the WSGIPath under Software Configuration.

Disclaimer: This information is valid until 4 November 2016. AWS may further change the setting.

Upvotes: 6

DenisH
DenisH

Reputation: 889

I found that you have to restart the server for it to take these changes into consideration.

I spent ages changing and tweaking these options and nothing worked. Then when I went to the EB console and restarted the environment it worked.

Upvotes: 11

Daniel Roseman
Daniel Roseman

Reputation: 600059

You have WSGIPath set to "application.py" but your WSGI file is "mysite/wsgi.py".

Upvotes: 0

Related Questions