简体   繁体   English

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

[英]Cannot resolve “wsgi.py cannot be loaded as a Python module” error, even when making a fresh project in django

I am currently using windows, trying to deploy a django project to elastic beanstalk. 我目前正在使用Windows,尝试将django项目部署到弹性beanstalk。 I am following this tutorial: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html , and even after following it step by step, for a fresh project, I encounter a 500 error, detailing that my wsgi file cannot be imported. 我正在关注本教程: https//docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html ,甚至在逐步完成后,为了一个新项目,我遇到了500错误,详细说明我的wsgi文件无法导入。 I read online some solutions used chmod, but because I am using windows, I believe that command doesn't exist. 我在网上看了一些使用chmod的解决方案,但因为我使用的是windows,我相信命令不存在。 How can I solve this problem? 我怎么解决这个问题?

Here are the logs. 这是日志。

[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):

Ok I figured out the error. 好的,我发现了错误。 I was using python 3.6 and django 2.2.1, but apparently I can only use django 2.1.1 with python 3.6. 我使用的是python 3.6和django 2.2.1,但显然我只能使用django 2.1.1和python 3.6。 Kind of silly seeing as the aws docs says django 2.2 is valid with that version of python. 有点愚蠢看到aws文档说django 2.2对那个版本的python有效。 This was an unnecessary headache. 这是一个不必要的头痛。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM