apache + mod-wsgi:ImportError:没有名为站点的模块

时间:2019-07-13 02:05:09

标签: python centos7 mod-wsgi

我在服务器上创建了两个python版本,并将项目分配给虚拟环境的python版本。但是得到了

  

ImportError:没有名为站点的模块

我在哪里做错了?

一些注意事项:

  

centos7
  python3
  mod-wsgi

httpd.conf:

WSGIPythonHome "/usr/local/python3/bin/oway/lib/python3.7/site-packages"
WSGIPythonPath /var/www/html/oway/mall_stock:/usr/local/python3/bin/oway/lib/python3.7/site-packages

<VirtualHost *:80>
  WSGIScriptAlias / /var/www/html/oway/mall_stock/mall_stock/wsgi.py
  #WSGIDeamonProcess oway python-path=/usr/local/python3/bin/oway/lib/python3.7/site-packages
  #WSGIProcessGroup oway
  LoadModule wsgi_module modules/mod_wsgi.so
  ErrorLog "logs/error_log"
  DocumentRoot "/var/www/html/oway"
  ServerName www.owaycare.com
  ServerAlias owaycare.com
  Alias /static /var/www/html/oway/mall_stock/static
  Alias /media /var/www/html/oway/mall_stock/media
  Redirect permanent "/" "https://www.owaycare.com/"

  <Directory /var/www/html/oway/mall_stock/static>
   Require all granted
  </Directory>

  <Directory /var/www/html/oway/mall_stock/media>
    Require all granted
  </Directory>

  <Directory /var/www/html/oway/mall_stock>
    <Files wsgi.py>
      AllowOverride All
      Require all granted
    </Files>
  </Directory>

</VirtualHost>

wsgi.py:

#!/usr/bin/python3
import os
import sys
import site
site.addsitedir('/usr/local/python3/bin/oway/lib/python3.7/site-packages')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mall_stock.settings')

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

path = '/var/www/html/oway/mall_stock'
if path not in sys.path:
   sys.path.append(path)

1 个答案:

答案 0 :(得分:-1)

虚拟环境未指定python版本