简体   繁体   English

ModuleNotFoundError:部署到ElasticBeanstalk时没有名为'django'的模块

[英]ModuleNotFoundError: No module named 'django' while deploying to ElasticBeanstalk

Tried multiple solutions online but couldnt get it working ! 在线尝试了多种解决方案,但无法使其正常运行! Basically my application is deployed but http response is "Internal Server Error". 基本上我的应用程序已部署,但http响应是“内部服务器错误”。 On investigating EB logs i found the following traceback. 在调查EB日志时,我发现了以下追溯。

[Sat Jun 08 10:28:56.880823 2019] [:error] [pid 4776] [remote 172.31.4.251:180] Traceback (most recent call last):
[Sat Jun 08 10:28:56.880846 2019] [:error] [pid 4776] [remote 172.31.4.251:180]   File "/opt/python/current/app/modelforms/modelforms/wsgi.py", line 12, in <module>
[Sat Jun 08 10:28:56.880863 2019] [:error] [pid 4776] [remote 172.31.4.251:180]     from django.core.wsgi import get_wsgi_application
[Sat Jun 08 10:28:56.880878 2019] [:error] [pid 4776] [remote 172.31.4.251:180] ModuleNotFoundError: No module named 'django'
[Sat Jun 08 10:29:10.828039 2019] [:error] [pid 4776] [remote 172.31.42.54:180] mod_wsgi (pid=4776): Target WSGI script '/opt/python/current/app/modelforms/modelforms/wsgi.py' cannot be loaded as Python module.
[Sat Jun 08 10:29:10.828089 2019] [:error] [pid 4776] [remote 172.31.42.54:180] mod_wsgi (pid=4776): Exception occurred processing WSGI script '/opt/python/current/app/modelforms/modelforms/wsgi.py'.

My requirements.txt is placed in all directories and yet django module is not recognised. 我的requirements.txt放在所有目录中,但无法识别django模块。 It seems it hasn't been installed at first place. 它似乎还没有安装在第一位。 The file's contents are: 该文件的内容是:

Django==2.2.1
Pillow==6.0.0
pytz==2019.1
sorl-thumbnail==12.5.0
sqlparse==0.3.0

Any help is appreciated. 任何帮助表示赞赏。

EDIT1: I dont have ebextentions setup, however the same config's are present when i run " eb config" 编辑1:我没有设置ebextentions,但是当我运行“eb config”时,会出现相同的配置

 aws:elasticbeanstalk:container:python:
    NumProcesses: '1'
    NumThreads: '15'
    StaticFiles: /static/=static/
    WSGIPath: modelforms/modelforms/wsgi.py
  aws:elasticbeanstalk:container:python:staticfiles:
    /static/: static/
aws:elasticbeanstalk:environment:
    EnvironmentType: LoadBalanced
    ExternalExtensionsS3Bucket: null
    ExternalExtensionsS3Key: null
    LoadBalancerType: application
    ServiceRole: aws-elasticbeanstalk-service-role



Try adding your DJANGO_SETTINGS_MODULE and PYTHONPATH to the config 尝试将DJANGO_SETTINGS_MODULE和PYTHONPATH添加到配置中

  "aws:elasticbeanstalk:application:environment":
    DJANGO_SETTINGS_MODULE: "modelforms.settings"
    "PYTHONPATH": "/opt/python/current/app/modelforms:$PYTHONPATH"

Also, check the Health dashboard and make sure it shows as deployed before testing 此外,请检查运行状况仪表板,并确保在测试之前将其显示为已部署

暂无
暂无

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

相关问题 Django / Heroku 部署 - ModuleNotFoundError:“没有名为 'django' 的模块” - Django / Heroku Deploying - ModuleNotFoundError: "No module named 'django'" ModuleNotFoundError:在 Azure 上部署没有名为“django”的模块 - ModuleNotFoundError: No module named 'django' by Deploying on Azure ModuleNotFoundError:没有名为“application”的模块 [部署 Django 到 AWS] - ModuleNotFoundError: No module named 'application' [Deploying Django to AWS] ModuleNotFoundError:没有名为“ gi”的模块-在Heroku中部署时 - ModuleNotFoundError: No module named 'gi' - While deploying in Heroku ModuleNotFoundError:部署到 Elastic Beanstalk 时没有名为“django”的模块 - ModuleNotFoundError: No module named 'django' when deploying to Elastic Beanstalk 将 Django 部署到 Heroku 时:ModuleNotFoundError: No module named &#39;dotenv&#39; - When deploying Django to Heroku: ModuleNotFoundError: No module named 'dotenv' ModuleNotFoundError:“没有命名的模块<mymodule> ",从 Django 部署到 Heroku 时</mymodule> - ModuleNotFoundError: "No module named <mymodule>", when deploying to Heroku from Django 将 Django 部署到 Heroku 时:ModuleNotFoundError: No module named 'env' - When deploying Django to Heroku: ModuleNotFoundError: No module named 'env' 在 GCP 上部署 OpenLiteSpeed django 解决方案时出现“ModuleNotFoundError(”No module named 'MySQLdb'“,)” - “ModuleNotFoundError(”No module named 'MySQLdb'“,)” when deploying a OpenLiteSpeed django solution on GCP ModuleNotFoundError: 没有名为 &#39;django 的模块 - ModuleNotFoundError: No module named 'django
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM