gpt4 book ai didi

python - ModuleNotFoundError : No module named 'django'

转载 作者:行者123 更新时间:2023-12-04 12:26:00 26 4
gpt4 key购买 nike

我正在尝试在线制作一个项目,但有一个我自己无法解决的错误。
我已经安装了 django,但是服务器给了我这个错误。
Virtualenv 也处于事件状态。

2017-09-25 20:10:27,471: ***************************************************
2017-09-25 20:10:30,892: Error running WSGI application
2017-09-25 20:10:30,893: ModuleNotFoundError: No module named 'django'
2017-09-25 20:10:30,893: File "/var/www/asd1_pythonanywhere_com_wsgi.py", line 17, in <module>
2017-09-25 20:10:30,893: from django.core.wsgi import get_wsgi_application
2017-09-25 20:10:30,893: ***************************************************
2017-09-25 20:10:30,893: If you're seeing an import error and don't know why,
2017-09-25 20:10:30,894: we have a dedicated help page to help you debug:
2017-09-25 20:10:30,894: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-09-25 20:10:30,894: ***************************************************


Wsgi 文件是这样的:
    import os
import sys


path = '/home/asd1/mysite'
if path not in sys.path:
sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

托管是 pythonanywhere.com

最佳答案

您需要安装 Django。您可能忘记在环境处于事件状态时安装它。

您可以了解如何执行此操作 here .

这也可能是因为您将项目命名为“django”之类的名称,这会与已安装的软件包发生冲突。

关于python - ModuleNotFoundError : No module named 'django' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46413676/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com