Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 585
user2492364 Avatar asked Sep 30 '14 12:09

user2492364


3 Answers

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.

like image 176
DenisH Avatar answered Nov 07 '22 14:11

DenisH


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.

like image 33
Zhang Ran Avatar answered Nov 07 '22 16:11

Zhang Ran


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
like image 5
shivangg Avatar answered Nov 07 '22 14:11

shivangg