无法解决"wsgi.py 无法加载为 Python 模块"错误,即使在 django 中创建新项目时也是如此



我当前正在使用Windows,试图将Django项目部署到弹性beanstalk。我正在关注本教程:https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html500错误,详细说明我的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 3.6和Django 2.2.1,但显然我只能将Django 2.1.1与Python 3.6一起使用。正如AWS Docs所说,Django 2.2在该版本的Python上有效。这是一个不必要的头痛。