繁体   English   中英

ModuleNotFoundError:将 Django 应用程序部署到 AWS EB 时没有名为“application”的模块

[英]ModuleNotFoundError: No module named 'application' when deploying Django app to AWS EB

我正在尝试将 Django Python 3.8 项目部署到 Amazon Linux 2/3.4.2 64 位上的 Elastic Beanstalk。

我在.ebeextensions/django.config中有以下代码:

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: pos.wsgi:application
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: pos.settings

我一直在日志ModuleNotFoundError: No module named 'application'中看到这个错误。

我试过用这种方式写配置文件,但仍然是同样的错误:

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: pos/wsgi.py

除了在 django.config 中有这个块之外,我还必须在 elastic beanstalk 配置中指定 wsgi 路径。

option_settings:
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: "pos.settings"
    PYTHONPATH: "/var/app/current:$PYTHONPATH"
  aws:elasticbeanstalk:container:python:
    WSGIPath: "pos.wsgi:application"

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM