简体   繁体   中英

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

I'm trying to deploy a Django Python 3.8 project to Elastic Beanstalk on Amazon Linux 2/3.4.2 64bit.

I have the following code in .ebeextensions/django.config :

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

I see this error all the time in the logs ModuleNotFoundError: No module named 'application' .

I've tried to write the config file this way, but still the same error:

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

Besides having this block in django.config I also had to specify the wsgi path in elastic beanstalk cinfiguration.

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

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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