简体   繁体   中英

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. 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. I read online some solutions used chmod, but because I am using windows, I believe that command doesn't exist. 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. Kind of silly seeing as the aws docs says django 2.2 is valid with that version of python. This was an unnecessary headache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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