Apaceh2, DJango, ошибки WSGI "No such file or directory: mod_wsgi".

Я пытаюсь заставить мое приложение django обслуживаться на appache2, и столкнулся с различными ошибками. Я разобрался с большинством из них, но теперь получаю ошибку ниже. Я нашел других людей с похожими проблемами, но решения не нашел. Пожалуйста, помогите.

error.log

[Fri Oct 28 16:42:15.537187 2022] [wsgi:warn] [pid 100608] (2)No such file or directory: mod_wsgi (pid=100608): Unable to stat Python home /home/ubuntu/django-app/env. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path.
Python path configuration:
  PYTHONHOME = '/home/ubuntu/django-app/env'
  PYTHONPATH = (not set)
  program name = 'python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/home/ubuntu/django-app/env'
  sys.base_exec_prefix = '/home/ubuntu/django-app/env'
  sys.platlibdir = 'lib'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/home/ubuntu/django-app/env'
  sys.exec_prefix = '/home/ubuntu/django-app/env'
  sys.path = [
    '/home/ubuntu/django-app/env/lib/python310.zip',
    '/home/ubuntu/django-app/env/lib/python3.10',
    '/home/ubuntu/django-app/env/lib/python3.10/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fb6911f8780 (most recent call first):
  <no Python frame>

ubuntu@ip-172-31-34-187:~$ apachectl -M

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 reqtimeout_module (shared)
 setenvif_module (shared)
 status_module (shared)
 wsgi_module (shared)

Также я пробовал разные способы определения PYTHONPATH, но журнал всегда показывает, что он (не установлен):

WSGIPythonPath /home/ubuntu/django-apps/myapp/
and
WSGIDaemonProcess lotto python-path=/home/ubuntu/django-app/myapp python-home=/home/ubuntu/django-app/env

Мой полный /etc/apache2/sites-available/000-default.conf

#WSGIPythonPath /home/ubuntu/django-apps/myapp /
<VirtualHost *:80>
        ServerName pcshare.net

        Alias /static /home/ubuntu/django-apps/myapp/main/static
        <Directory /home/ubuntu/django-apps/myapp/main/static>
                Require all granted
        </Directory>

        <Directory /home/ubuntu/django-apps/myapp/myapp>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>

        WSGIDaemonProcess lotto python-path=/home/ubuntu/django-app/myapp python-home=/home/ubuntu/django-app/env
        WSGIProcessGroup myapp
        WSGIScriptAlias / /home/ubuntu/django-apps/myapp/myapp/wsgi.py
        ServerAdmin webmaster@localhost
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Мои каталоги:

/home/ubuntu/django-apps
                     |---env/
                     |---myapp/
                           |---myapp/
                           |       |---wsgi.py
                           |---main/
                                  |---static/
Вернуться на верх