For the past few days, I have been referring to Stackoverflow to solve my problem. Im hosting Django application using WSGI on Amazon Linux 2. I'm using pyenv for multiple python versions here. And the python version is 3.7.10. Below is my Apache Conf and wsgi.py.
# WSGI config for mysite project.
#
# It exposes the WSGI callable as a module-level variable named
# ``application``.
#
# For more information on this file, see
# https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ """
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
application = get_wsgi_application()
<VirtualHost *:80>
ServerName wsgi.iamvishnu.xyz
#DocumentRoot /var/www/html
#for django
LoadModule wsgi_module modules/mod_wsgi_python3.so
Alias /static/ /home/mod-wsgi/mysite/static/
<Directory /home/mod-wsgi/mysite>
Require all granted
</Directory>
<Directory /home/mod-wsgi/mysite/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess mysite user=mod-wsgi2 group=mod-wsgi2
python-path=/home/mod-wsgi2:/home/mod-wsgi2/mysite:/home/mod-wsgi2/mysite/mysite:/home/mod-wsgi2/.pyenv/versions/3.6.8/envs/virtual/lib/python3.6/site-packages
WSGIProcessGroup mysite
WSGIScriptAlias / /home/mod-wsgi2/mysite/mysite/wsgi.py
Below is the error im getting from apache error log
Current thread 0x00007fd4b2087240 (most recent call first): [Tue Aug
03 05:27:15.145298 2021] [core:notice] [pid 24159] AH00052: child pid
24229 exit signal Aborted (6) Fatal Python error: initfsencoding:
unable to load the file system codec ModuleNotFoundError: No module
named 'encodings'
Current thread 0x00007fd4b2087240 (most recent call first): [Tue Aug
03 05:27:16.147167 2021] [core:notice] [pid 24159] AH00052: child pid
24230 exit signal Aborted (6) Fatal Python error: initfsencoding:
unable to load the file system codec ModuleNotFoundError: No module
named 'encodings'
Current thread 0x00007fd4b2087240 (most recent call first): [Tue Aug
03 05:27:17.149010 2021] [core:notice] [pid 24159] AH00052: child pid
24231 exit signal Aborted (6) Fatal Python error: initfsencoding:
unable to load the file system codec ModuleNotFoundError: No module
named 'encodings'
Can someone tell me what did i missed here. I will be providing more information regarding the same if required. Any assistance you can provide would be greatly appreciated.