Django弹性豆茎部署显示404

时间:2022-08-25 08:36:07

I'm attempting to deploy my first Django app to Elastic Beanstalk. The Beanstalk created successfully via command line tools, I uploaded from my Mercurial via ZIP, that seemed to work just fine. But I'm getting a 404 when attempting to access it.

我正在尝试将我的第一个Django应用部署到Elastic Beanstalk中。通过命令行工具成功地创建了Beanstalk,我通过ZIP上传了我的Mercurial,看起来效果不错。但是当我尝试访问它时,我得到了一个404。

Elastic Beanstalk HTTP Error (the log is huge, I can parse more, but I only see this for an error)

弹性Beanstalk HTTP错误(日志很大,我可以解析更多,但我只看到一个错误)

[Fri Jan 03 18:08:26 2014] [error] [client 127.0.0.1] Target WSGI script not found or unable to stat: /opt/python/current/app/application.py

[error][客户端127.0.0.1]针对未找到或无法统计的WSGI脚本:/opt/python/current/app/application.py

WSGI Settings for the Django app

Django应用程序的WSGI设置

wsgi.py

wsgi.py

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "company.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

settings.py

settings.py

WSGI_APPLICATION = 'company.wsgi.application'

This works fine locally and I'm sure I'm just not understanding something that I should be.

这在本地运行得很好,我确信我只是不理解我应该是什么。

Please help!

请帮助!

Folder structure:

文件夹结构:

 /opt/python/current/app/

  - company
     - static
     - templates
     - wsgi.py
     - settings.py
     - __init__.py
     - urls.py

  - webapp
     - templates
  - manage.py
  - requirements.txt

1 个解决方案

#1


6  

AWS Elastic Beanstalk's default configuration sets WSGIPath to application.py, you either need to rename your file with mappings to application.py or configure the environment to point to your mappings script.

AWS弹性Beanstalk的默认配置将WSGIPath设置为应用程序。py,您可能需要将您的文件重命名为应用程序的映射。py或配置环境以指向您的映射脚本。

Detailed information can be found in AWS Elastic Beanstalk Python Container Options: Option Values

详细信息可以在AWS弹性Beanstalk Python容器选项:选项值中找到

You can set it with the management console

您可以使用管理控制台设置它

Django弹性豆茎部署显示404

Or with .ebextensions option_settings

或与.ebextensions option_settings

NB: It should be relative path.

NB:应该是相对路径。

#1


6  

AWS Elastic Beanstalk's default configuration sets WSGIPath to application.py, you either need to rename your file with mappings to application.py or configure the environment to point to your mappings script.

AWS弹性Beanstalk的默认配置将WSGIPath设置为应用程序。py,您可能需要将您的文件重命名为应用程序的映射。py或配置环境以指向您的映射脚本。

Detailed information can be found in AWS Elastic Beanstalk Python Container Options: Option Values

详细信息可以在AWS弹性Beanstalk Python容器选项:选项值中找到

You can set it with the management console

您可以使用管理控制台设置它

Django弹性豆茎部署显示404

Or with .ebextensions option_settings

或与.ebextensions option_settings

NB: It should be relative path.

NB:应该是相对路径。