【问题标题】:WSGI error using Django 2.2 on Elastic Beanstalk在 Elastic Beanstalk 上使用 Django 2.2 时出现 WSGI 错误
【发布时间】:2020-02-10 21:53:24
【问题描述】:

尝试访问部署到 AWS Elastic Beanstalk 的 Django 2.2 Web 应用程序会出现 500 错误。检查弹性豆茎日志时,会显示以下错误。

 mod_wsgi (pid=3388): Target WSGI script '/opt/python/current/app/app_name/wsgi.py' cannot be loaded as Python module.
 mod_wsgi (pid=3388): Exception occurred processing WSGI script '/opt/python/current/app/app_name/wsgi.py'.
 Traceback (most recent call last):
   File "/opt/python/current/app/app_name/wsgi.py", line 16, in <module>
     application = get_wsgi_application()
   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
     django.setup(set_prefix=False)
   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
     apps.populate(settings.INSTALLED_APPS)
   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate
     raise RuntimeError("populate() isn't reentrant")
 RuntimeError: populate() isn't reentrant

【问题讨论】:

    标签: django mod-wsgi amazon-elastic-beanstalk


    【解决方案1】:

    这是因为 Django 2.2(在撰写本文时)与 EB 不兼容。

    https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html

    Django 2.2 与 Elastic Beanstalk Python 3.6 不兼容 平台。最新的兼容版本是 Django 2.1。

    【讨论】:

    • 您有任何进一步解释来源的链接吗? Beanstalk 的 Python 3.6 版本有什么特别之处?
    • 不确定,我在亚马逊上找不到任何其他解释。我降级到 django 2.1,问题解决了。
    • 这有改变吗?几个月前,我使用 Django 3.0.5 版部署了一个应用程序,它运行良好。我现在创建了一个新应用程序,它现在给我高于 2.1 的 Django 版本同样的错误。
    猜你喜欢
    • 1970-01-01
    • 2017-01-17
    • 1970-01-01
    • 2022-12-09
    • 2020-11-10
    • 2015-09-18
    • 2016-10-17
    • 2015-08-04
    • 2015-10-01
    相关资源
    最近更新 更多