Amazon Elastic Beanstalk:如何设置wsgi路径?

时间:2022-09-09 23:18:31

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

我在那里练习在Elastic Beanstalk下设置Django。但是有错误。

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 :

和我的.elasticbeanstalk / optionsettings.djapp文件是这样的:

Amazon Elastic Beanstalk:如何设置wsgi路径?

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

和.ebextensions / python.config这样,我不知道在哪里放这个.try几次仍然无法正常工作。我尝试mysite / mysite / wsgi.py仍然无法正常工作

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 ??

请告诉我如何设置我的wsgi路径?

Thank you very much!

非常感谢你!

4 个解决方案

#1


6  

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.

我花了很长时间改变和调整这些选项,没有任何效果。然后,当我去EB控制台并重新启动环境时,它工作正常。

#2


4  

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

在服务器中,您将要将django应用程序部署到elasticbean stalk。跑:

eb config

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

然后将application.py替换为mysite / wsgi.py并保存更改。

After the update, you may do:

更新后,您可以:

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

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.

成功更新环境后,您可以查看elasticbeanstalk中的更改,在您的环境下,转到实例并检查Configuration中的设置,然后在Software Configuration下查看WSGIPath。

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

免责声明:此信息有效期至2016年11月4日.AWS可能会进一步更改设置。

#3


2  

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

指定的路径应该相对于.elasticbeanstalk目录。正确的路径应该是mysite / mysite.wsgi.py。 option_settings:是:

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

#4


0  

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

您将WSGIPath设置为“application.py”,但您的WSGI文件是“mysite / wsgi.py”。

#1


6  

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.

我花了很长时间改变和调整这些选项,没有任何效果。然后,当我去EB控制台并重新启动环境时,它工作正常。

#2


4  

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

在服务器中,您将要将django应用程序部署到elasticbean stalk。跑:

eb config

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

然后将application.py替换为mysite / wsgi.py并保存更改。

After the update, you may do:

更新后,您可以:

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

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.

成功更新环境后,您可以查看elasticbeanstalk中的更改,在您的环境下,转到实例并检查Configuration中的设置,然后在Software Configuration下查看WSGIPath。

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

免责声明:此信息有效期至2016年11月4日.AWS可能会进一步更改设置。

#3


2  

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

指定的路径应该相对于.elasticbeanstalk目录。正确的路径应该是mysite / mysite.wsgi.py。 option_settings:是:

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

#4


0  

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

您将WSGIPath设置为“application.py”,但您的WSGI文件是“mysite / wsgi.py”。