【问题标题】:Elastic Beanstalk not detecting my WSGIPath - ModuleNotFoundErrorElastic Beanstalk 未检测到我的 WSGIPath - ModuleNotFoundError
【发布时间】:2023-03-12 14:49:01
【问题描述】:

我正在尝试将我的 Odoo 实例部署到 Elastic Beanstalk,并且收到以下错误消息:

Jan 11 23:08:24 ip-172-31-31-143 web: ModuleNotFoundError: No module named 'setup/wsgi'
Jan 11 23:08:24 ip-172-31-31-143 web: During handling of the above exception, another exception occurred:
Jan 11 23:08:24 ip-172-31-31-143 web: Traceback (most recent call last):
Jan 11 23:08:24 ip-172-31-31-143 web: File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
Jan 11 23:08:24 ip-172-31-31-143 web: worker.init_process()
Jan 11 23:08:24 ip-172-31-31-143 web: File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
Jan 11 23:08:24 ip-172-31-31-143 web: super().init_process()
Jan 11 23:08:24 ip-172-31-31-143 web: File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
Jan 11 23:08:24 ip-172-31-31-143 web: self.load_wsgi()
Jan 11 23:08:24 ip-172-31-31-143 web: File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
Jan 11 23:08:24 ip-172-31-31-143 web: self.wsgi = self.app.wsgi()
Jan 11 23:08:24 ip-172-31-31-143 web: File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
Jan 11 23:08:24 ip-172-31-31-143 web: self.callable = self.load()
Jan 11 23:08:24 ip-172-31-31-143 web: File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
Jan 11 23:08:24 ip-172-31-31-143 web: return self.load_wsgiapp()
Jan 11 23:08:24 ip-172-31-31-143 web: File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
Jan 11 23:08:24 ip-172-31-31-143 web: return util.import_app(self.app_uri)
Jan 11 23:08:24 ip-172-31-31-143 web: File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/gunicorn/util.py", line 362, in import_app
Jan 11 23:08:24 ip-172-31-31-143 web: raise ImportError(msg % (module.rsplit(".", 1)[0], obj))
Jan 11 23:08:24 ip-172-31-31-143 web: ImportError: Failed to find application, did you mean 'setup/wsgi:application'?

这是我的 .ebextension 配置文件中的内容:

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: setup/wsgi.py:application

文件夹结构:

Odoo
-.ebextensions
-...
-setup
--...
--wsgi.py
-...

我尝试了许多不同的方法来解决这个问题,但都没有成功:

  • 在 .ebextensions 上有 wsgi.py 的完整路径
  • 将文件重命名为更简单的名称(“odoo-wsgi.py”为“wsgi.py”)
  • 将 /var/app/current 添加到 PYTHONPATH

【问题讨论】:

    标签: python amazon-elastic-beanstalk odoo wsgi ebextensions


    【解决方案1】:

    根据 gunicorn 文档,点路径是必需的,所以这是我需要放入 WSGIPath 的内容:

    option_settings:
      aws:elasticbeanstalk:container:python:
        WSGIPath: setup.wsgi:application
    

    注意:这会导致部署 Odoo 时出现更多错误,但要等到我可以再次发布,因为这是一个不同的问题。

    【讨论】:

      猜你喜欢
      • 2012-10-17
      • 2015-09-18
      • 2013-03-23
      • 1970-01-01
      • 2016-08-22
      • 2016-12-03
      • 2020-05-09
      • 2018-04-16
      相关资源
      最近更新 更多