linux 借助mod_wsgi在apache上部署django 错误 5C

linux 借助mod_wsgi在apache上部署django 报ImportError:No module named os

[Thu Jan 18 09:31:00 2018] [error] Traceback (most recent call last):
[Thu Jan 18 09:31:00 2018] [error] File "/test/Model_Demo/Model_Demo/wsgi.py", line 12, in
[Thu Jan 18 09:31:00 2018] [error] import os
[Thu Jan 18 09:31:00 2018] [error] ImportError: No module named os

wsgi.py代码如下:
import os
import sys
sys.path.append("/test/Model_Demo/")
print sys.path
from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Model_Demo.settings")

application = get_wsgi_application()

2个回答

是不是不识别,或者是所获取的文件路径不正确。

The issue was changing PYTHONHOME, which could not find any modules because I have python running out of a user directory /Users/alavin89/Library/Python/2.7/lib/python/site-packages. Check the python path by running echo $PYTHONPATH.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!