我正在尝试在CentOS 7上部署django项目,但是我在httpd错误日志中一直得到ImportError: No module named site
。
这是我在/etc/httpd/conf.d
上的httpd配置文件:
<VirtualHost *:8008>
WSGIProcessGroup programa_registos
WSGIDaemonProcess programa_registos python-home=/var/www/html/programa_registos/.env python-path=/var/www/html/programa_registos
Alias /static /var/www/html/programa_registos/static
<Directory /var/www/html/programa_registos/static>
Require all granted
</Directory>
WSGIScriptAlias / /var/www/html/programa_registos/programa_registos/wsgi.py
<Directory /var/www/html/programa_registos/programa_registos>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
我的项目位于/var/www/html/programa_registos
,我的virtualenv位于/var/www/html/programa_registos/.env
。
这是我的wsgi.py文件,位于/var/www/html/programa_registos/programa_registos
:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "programa_registos.settings")
application = get_wsgi_application()