I am trying to publish the site created by Django using apache. The settings of the server are as follows.
・ CentOS 7.2
・ Python 3.6
・ Django 2.0
・ apache 2.4
I am preparing a virtual environment using pyenv as follows.
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
…
pyenv install anaconda3-5.1.0
pyenv rehash
pyenv global anaconda3-5.1.0
…
yum install httpd httpd-devel
systemctl start httpd
systemctl enable httpd
….
wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.5.14.tar.gz
tar -zxvf 4.5.14.tar.gz
cd mod_wsgi-4.5.14/
./configure --with-python=/home/username/.pyenv/versions/anaconda3-5.1.0/bin/python
make
sudo make install
…
■ httpd.conf
NameVirtualHost *:80
LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so
WSGISocketPrefix /var/run/wsgi
<VirtualHost *:80>
ServerName xxx.com
DocumentRoot /var/www/html
WSGIScriptReloading On
WSGIDaemonProcess xxx python-path=/home/username/.pyenv/versions/anaconda3-5.1.0/lib/python3.6/site-packages python-home=/home/username/.pyenv/versions/anaconda3-5.1.0
WSGIProcessGroup xxx
WSGIScriptAlias / /var/www/html/xxx/xxx/wsgi.py
<Directory "/xxx/">
Order deny,allow
</Directory>
</VirtualHost>
The following error will occur with this setting.
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Setting chmod should be fine. What other reasons can be considered?