即使在Django中制作新项目时,也无法解决“ wsgi.py无法作为Python模块加载”错误

时间:2019-05-21 02:42:04

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

我当前正在使用Windows,试图将django项目部署到弹性beantalk。我正在按照本教程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):

1 个答案:

答案 0 :(得分:0)

好的,我弄清楚了错误。我正在使用python 3.6和django 2.2.1,但是显然我只能在python 3.6上使用django 2.1.1。有点愚蠢的发现,就像AWS文档说django 2.2在该版本的python中有效一样。这是不必要的头痛。