qq_30266359
renjian1995
2018-01-18 02:26

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

5
  • apache
  • django
  • linux

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条回答