【问题标题】:Cannot resolve "wsgi.py cannot be loaded as a Python module" error, even when making a fresh project in django无法解决“wsgi.py 无法作为 Python 模块加载”错误,即使在 django 中创建新项目时也是如此
【发布时间】:2019-05-21 12:23:18
【问题描述】:

我目前正在使用 windows,试图将 django 项目部署到弹性 beanstalk。我正在关注这个教程:https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html,即使一步一步地遵循它,对于一个新项目,我遇到一个 500 错误,详细说明我的 wsgi 文件无法导入。我在网上阅读了一些使用 chmod 的解决方案,但是因为我使用的是 windows,所以我相信该命令不存在。我怎么解决这个问题?

这里是日志。

[Tue May 21 02:24:21.288362 2019] [:error] [pid 4423] [remote 127.0.0.1:140]     apps.populate(settings.INSTALLED_APPS)
[Tue May 21 02:24:21.288367 2019] [:error] [pid 4423] [remote 127.0.0.1:140]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate
[Tue May 21 02:24:21.288370 2019] [:error] [pid 4423] [remote 127.0.0.1:140]     raise RuntimeError("populate() isn't reentrant")
[Tue May 21 02:24:21.288384 2019] [:error] [pid 4423] [remote 127.0.0.1:140] RuntimeError: populate() isn't reentrant
[Tue May 21 02:24:46.028052 2019] [:error] [pid 4423] [remote 172.31.20.41:140] mod_wsgi (pid=4423): Target WSGI script '/opt/python/current/app/test/wsgi.py' cannot be loaded as Python module.
[Tue May 21 02:24:46.028101 2019] [:error] [pid 4423] [remote 172.31.20.41:140] mod_wsgi (pid=4423): Exception occurred processing WSGI script '/opt/python/current/app/test/wsgi.py'.
[Tue May 21 02:24:46.028208 2019] [:error] [pid 4423] [remote 172.31.20.41:140] Traceback (most recent call last):

【问题讨论】:

    标签: python django amazon-web-services amazon-elastic-beanstalk


    【解决方案1】:

    好的,我发现了错误。我使用的是 python 3.6 和 django 2.2.1,但显然我只能将 django 2.1.1 与 python 3.6 一起使用。有点愚蠢,因为 aws 文档说 django 2.2 对那个版本的 python 有效。这是一个不必要的头痛。

    【讨论】:

      猜你喜欢
      • 2020-10-31
      • 1970-01-01
      • 1970-01-01
      • 2020-09-09
      • 1970-01-01
      • 2021-07-04
      • 1970-01-01
      • 2018-11-11
      • 2018-01-27
      相关资源
      最近更新 更多