apache2 Ubuntu django:无法上传我的 django 应用程序

apache2 Ubuntu django:无法上传我的 django 应用程序

我尝试上传我的 Django 2.2 项目,但是在 Ubuntu 18.04 中输入以下命令时出现此错误cat /var/log/apache2/error.log

(13)Permission denied: mod_wsgi (pid=7692): 
Unable to stat Python home /root/project_name/venv/. 
Python interpreter may not be able to be initialized correctly. 
Verify the supplied path and access permissions for whole of the path.
Fatal Python error: Py_Initialize: Unable to get the locale encoding  
ModuleNotFoundError: No module named 'encodings'

这是我的/etc/apache2/sites-available/django_proj.conf

<VirtualHost *:80>
    Alias /static /root/project_name/static
    <Directory /root/project_name/static>
        Require all granted
    </Directory>

    Alias /meida /root/project_name/meida
    <Directory /root/project_name/meida>
        Require all granted
    </Directory>

    <Directory /root/project_name/zettapc>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIScriptAlias / /root/project_name/project_name/wsgi.py
    WSGIDaemonProcess django_app python-path=/root/project_name python-home=/root/project_name/venv/
    WSGIProcessGroup django_app 

</VirtualHost>

这是我的 wsgi 配置

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')

application = get_wsgi_application()

我是否遗漏了什么,或者我做错了什么?

相关内容